diff options
Diffstat (limited to 'test/libyul/yulOptimizerTests/structuralSimplifier')
8 files changed, 62 insertions, 0 deletions
diff --git a/test/libyul/yulOptimizerTests/structuralSimplifier/empty_if_movable_condition.yul b/test/libyul/yulOptimizerTests/structuralSimplifier/empty_if_movable_condition.yul new file mode 100644 index 00000000..ee1975e7 --- /dev/null +++ b/test/libyul/yulOptimizerTests/structuralSimplifier/empty_if_movable_condition.yul @@ -0,0 +1,7 @@ +{ let a := mload(0) if a {} } +// ---- +// structuralSimplifier +// { +// let a := mload(0) +// pop(a) +// } diff --git a/test/libyul/yulOptimizerTests/structuralSimplifier/empty_if_non_movable_condition.yul b/test/libyul/yulOptimizerTests/structuralSimplifier/empty_if_non_movable_condition.yul new file mode 100644 index 00000000..5977297b --- /dev/null +++ b/test/libyul/yulOptimizerTests/structuralSimplifier/empty_if_non_movable_condition.yul @@ -0,0 +1,6 @@ +{ if mload(0) {} } +// ---- +// structuralSimplifier +// { +// pop(mload(0)) +// } diff --git a/test/libyul/yulOptimizerTests/structuralSimplifier/for_false_condition.sol b/test/libyul/yulOptimizerTests/structuralSimplifier/for_false_condition.sol new file mode 100644 index 00000000..b881a0a3 --- /dev/null +++ b/test/libyul/yulOptimizerTests/structuralSimplifier/for_false_condition.sol @@ -0,0 +1,10 @@ +{ + for { let a := 42 } 0 { a := a } { + let b := a + } +} +// ---- +// structuralSimplifier +// { +// let a := 42 +// } diff --git a/test/libyul/yulOptimizerTests/structuralSimplifier/if_false_condition.yul b/test/libyul/yulOptimizerTests/structuralSimplifier/if_false_condition.yul new file mode 100644 index 00000000..0895b1bb --- /dev/null +++ b/test/libyul/yulOptimizerTests/structuralSimplifier/if_false_condition.yul @@ -0,0 +1,5 @@ +{ if 0 { mstore(0, 0) } } +// ---- +// structuralSimplifier +// { +// } diff --git a/test/libyul/yulOptimizerTests/structuralSimplifier/if_true_condition.yul b/test/libyul/yulOptimizerTests/structuralSimplifier/if_true_condition.yul new file mode 100644 index 00000000..ca9cba06 --- /dev/null +++ b/test/libyul/yulOptimizerTests/structuralSimplifier/if_true_condition.yul @@ -0,0 +1,6 @@ +{ if 1 { mstore(0, 0) } } +// ---- +// structuralSimplifier +// { +// mstore(0, 0) +// } diff --git a/test/libyul/yulOptimizerTests/structuralSimplifier/nested.yul b/test/libyul/yulOptimizerTests/structuralSimplifier/nested.yul new file mode 100644 index 00000000..169a84d1 --- /dev/null +++ b/test/libyul/yulOptimizerTests/structuralSimplifier/nested.yul @@ -0,0 +1,6 @@ +{ if 1 { if 1 { for { mstore(0, 0) } 0 {} { mstore(2, 3) } if 0 { mstore(1, 2) } } } } +// ---- +// structuralSimplifier +// { +// mstore(0, 0) +// } diff --git a/test/libyul/yulOptimizerTests/structuralSimplifier/switch_only_default.yul b/test/libyul/yulOptimizerTests/structuralSimplifier/switch_only_default.yul new file mode 100644 index 00000000..7ca815a7 --- /dev/null +++ b/test/libyul/yulOptimizerTests/structuralSimplifier/switch_only_default.yul @@ -0,0 +1,11 @@ +{ + switch mload(0) default { mstore(1, 2) } +} +// ---- +// structuralSimplifier +// { +// pop(mload(0)) +// { +// mstore(1, 2) +// } +// } diff --git a/test/libyul/yulOptimizerTests/structuralSimplifier/switch_to_if.yul b/test/libyul/yulOptimizerTests/structuralSimplifier/switch_to_if.yul new file mode 100644 index 00000000..a741ac2f --- /dev/null +++ b/test/libyul/yulOptimizerTests/structuralSimplifier/switch_to_if.yul @@ -0,0 +1,11 @@ +{ + switch 1 case 2 { mstore(0, 0) } +} +// ---- +// structuralSimplifier +// { +// if eq(2, 1) +// { +// mstore(0, 0) +// } +// } |