mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7418 from ethereum/ssaReverseFix
Fix SSA reverser for declaration + self-assignment
This commit is contained in:
commit
63a8cda1d4
@ -56,6 +56,11 @@ void SSAReverser::operator()(Block& _block)
|
|||||||
identifier &&
|
identifier &&
|
||||||
identifier->name == varDecl->variables.front().name
|
identifier->name == varDecl->variables.front().name
|
||||||
)
|
)
|
||||||
|
{
|
||||||
|
// in the special case a == a_1, just remove the assignment
|
||||||
|
if (assignment->variableNames.front().name == identifier->name)
|
||||||
|
return make_vector<Statement>(std::move(_stmt1));
|
||||||
|
else
|
||||||
return make_vector<Statement>(
|
return make_vector<Statement>(
|
||||||
Assignment{
|
Assignment{
|
||||||
std::move(assignment->location),
|
std::move(assignment->location),
|
||||||
@ -69,6 +74,7 @@ void SSAReverser::operator()(Block& _block)
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Replaces
|
// Replaces
|
||||||
// let a_1 := E
|
// let a_1 := E
|
||||||
// let a := a_1
|
// let a := a_1
|
||||||
|
@ -40,6 +40,13 @@ class AssignmentCounter;
|
|||||||
* a := E
|
* a := E
|
||||||
* let a_1 := a
|
* let a_1 := a
|
||||||
*
|
*
|
||||||
|
* In the special case
|
||||||
|
* let a := E
|
||||||
|
* a := a
|
||||||
|
*
|
||||||
|
* the redundant assignment "a := a" is removed.
|
||||||
|
*
|
||||||
|
*
|
||||||
* Secondly, the SSA transform will rewrite
|
* Secondly, the SSA transform will rewrite
|
||||||
*
|
*
|
||||||
* let a := E
|
* let a := E
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
let a := calldataload(0)
|
||||||
|
a := a
|
||||||
|
}
|
||||||
|
// ====
|
||||||
|
// step: ssaReverser
|
||||||
|
// ----
|
||||||
|
// { let a := calldataload(0) }
|
Loading…
Reference in New Issue
Block a user