-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement common subexpression elimination
Signed-off-by: Lucas Steuernagel <[email protected]>
- Loading branch information
Showing
16 changed files
with
2,107 additions
and
826 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
contract foo { | ||
|
||
struct stTest { | ||
int a; | ||
uint b; | ||
} | ||
|
||
function test6(int a, int b) public view returns (int ret) { | ||
stTest instance = stTest(2, 3); | ||
int x = a + b + instance.a; | ||
if(x + int(instance.b) < 0) { | ||
// Erro aqui? | ||
uint p = uint(a+b+instance.a); | ||
bool e = p > 50; | ||
} | ||
|
||
int8 trunc = int8(x); | ||
bool e2 = trunc > 2; | ||
int8 trunc2 = 8 + int8(x); | ||
bool e3 = trunc2 < trunc; | ||
bool e4 = e2 || e3; | ||
|
||
if (trunc2 < trunc && trunc > 2) { | ||
int p2 = a+b; | ||
int p3 = p2 - x + a + b; | ||
int p4 = p2-x; | ||
int p5 = p3 + a*b+45; | ||
|
||
if (p5 !=0) { | ||
uint16 t1 = uint16(p3 + a*b +45); | ||
uint32 t2 = uint32(a*b); | ||
bool e5 = t2 < t1; | ||
} | ||
|
||
ret = p3 + a*b + 45; | ||
} | ||
|
||
ret = a*b; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.