diff --git a/tests/snapshots/files__branch_hoisting-optimize.snap b/tests/snapshots/files__branch_hoisting-optimize.snap index 34bcf2751..43757ba1c 100644 --- a/tests/snapshots/files__branch_hoisting-optimize.snap +++ b/tests/snapshots/files__branch_hoisting-optimize.snap @@ -20,16 +20,16 @@ expression: visualization.result v14_: int = id c4_; .b15_: v16_: bool = eq v12_ v13_; - c17_: int = const 2; - c18_: int = const 1; - v19_: int = add c18_ v11_; - v20_: int = add c18_ v19_; - v21_: int = add c18_ v20_; - v22_: int = mul c17_ v21_; + c17_: int = const 1; + v18_: int = add c17_ v11_; + v19_: int = add c17_ v18_; + v20_: int = add c17_ v19_; + c21_: int = const 2; + v22_: int = mul c21_ v20_; c23_: int = const 3; - v24_: int = mul c23_ v21_; + v24_: int = mul c23_ v20_; v25_: int = select v16_ v22_ v24_; - v26_: int = add c18_ v21_; + v26_: int = add c17_ v20_; v27_: bool = lt v26_ v14_; v10_: int = id v25_; v11_: int = id v26_; diff --git a/tests/snapshots/files__if_invariant_dont_pull_out-optimize-sequential.snap b/tests/snapshots/files__if_invariant_dont_pull_out-optimize-sequential.snap new file mode 100644 index 000000000..d23e6e1d0 --- /dev/null +++ b/tests/snapshots/files__if_invariant_dont_pull_out-optimize-sequential.snap @@ -0,0 +1,49 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: 20 +@unrelated_fn(v0: int, v1: int): int { +.b2_: + c3_: int = const 3; + v4_: int = div v1 c3_; + v5_: int = div v0 v4_; + ret v5_; +} +@other_unrelated_fn(v0: int, v1: int): int { +.b2_: + c3_: int = const 5; + v4_: int = div v0 c3_; + v5_: int = div v1 v4_; + ret v5_; +} +@main(v0: int) { +.b1_: + c2_: int = const 0; + v3_: bool = gt v0 c2_; + v4_: int = abs v0; + c5_: int = const 2; + v6_: int = mul c5_ v4_; + br v3_ .b7_ .b8_; +.b7_: + v9_: int = sub v6_ v0; + v10_: int = add v0 v9_; + c11_: int = const 3; + v12_: int = div v10_ c11_; + v13_: int = div v0 v12_; + v14_: int = id v13_; + print v14_; + ret; + jmp .b15_; +.b8_: + v16_: int = abs v0; + v17_: int = add v16_ v6_; + v18_: int = add v0 v17_; + c19_: int = const 5; + v20_: int = div v0 c19_; + v21_: int = div v18_ v20_; + v14_: int = id v21_; + print v14_; + ret; +.b15_: +} diff --git a/tests/snapshots/files__if_invariant_dont_pull_out-optimize.snap b/tests/snapshots/files__if_invariant_dont_pull_out-optimize.snap new file mode 100644 index 000000000..14c1662b5 --- /dev/null +++ b/tests/snapshots/files__if_invariant_dont_pull_out-optimize.snap @@ -0,0 +1,44 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: 20 +@unrelated_fn(v0: int, v1: int): int { +.b2_: + c3_: int = const 3; + v4_: int = div v1 c3_; + v5_: int = div v0 v4_; + ret v5_; +} +@other_unrelated_fn(v0: int, v1: int): int { +.b2_: + c3_: int = const 5; + v4_: int = div v0 c3_; + v5_: int = div v1 v4_; + ret v5_; +} +@main(v0: int) { +.b1_: + c2_: int = const 0; + v3_: bool = gt v0 c2_; + v4_: int = abs v0; + c5_: int = const 2; + v6_: int = mul c5_ v4_; + br v3_ .b7_ .b8_; +.b7_: + c9_: int = const 3; + v10_: int = div v6_ c9_; + v11_: int = div v0 v10_; + v12_: int = id v11_; + print v12_; + ret; + jmp .b13_; +.b8_: + c14_: int = const 5; + v15_: int = div v0 c14_; + v16_: int = div v6_ v15_; + v12_: int = id v16_; + print v12_; + ret; +.b13_: +}