From 197f29106646a1b33748d736bebc4100897acbda Mon Sep 17 00:00:00 2001 From: Kirsten <32720576+kirstenmg@users.noreply.github.com> Date: Wed, 30 Oct 2024 21:28:21 -0700 Subject: [PATCH] Add snapshots --- .../peggy_comparison/branch_hoisting.bril | 0 .../conditional_constant_folding.bril | 0 .../peggy_comparison/dead_loop_deletion.bril | 0 .../{ => small}/peggy_comparison/if_true.bril | 0 .../loop_based_code_motion.bril | 0 .../loop_invariant_code_motion.bril | 0 .../peggy_comparison/loop_peeling.bril | 0 .../loop_strength_reduction.bril | 0 .../loop_strength_reduction_modified.bril | 0 .../peggy_comparison/loop_unroll.bril | 0 .../simple_loop_unswitch.bril | 0 ...__branch_hoisting-optimize-sequential.snap | 64 +++++++++++++ .../files__branch_hoisting-optimize.snap | 64 +++++++++++++ ..._constant_folding-optimize-sequential.snap | 10 ++ ...conditional_constant_folding-optimize.snap | 10 ++ ...ead_loop_deletion-optimize-sequential.snap | 42 +++++++++ .../files__dead_loop_deletion-optimize.snap | 42 +++++++++ .../files__if_true-optimize-sequential.snap | 12 +++ tests/snapshots/files__if_true-optimize.snap | 12 +++ ...based_code_motion-optimize-sequential.snap | 31 ++++++ ...iles__loop_based_code_motion-optimize.snap | 31 ++++++ ...riant_code_motion-optimize-sequential.snap | 63 +++++++++++++ ...__loop_invariant_code_motion-optimize.snap | 63 +++++++++++++ ...les__loop_peeling-optimize-sequential.snap | 35 +++++++ .../files__loop_peeling-optimize.snap | 35 +++++++ ...trength_reduction-optimize-sequential.snap | 47 ++++++++++ ...les__loop_strength_reduction-optimize.snap | 47 ++++++++++ ...eduction_modified-optimize-sequential.snap | 94 +++++++++++++++++++ ..._strength_reduction_modified-optimize.snap | 94 +++++++++++++++++++ ...iles__loop_unroll-optimize-sequential.snap | 28 ++++++ .../files__loop_unroll-optimize.snap | 28 ++++++ ...ple_loop_unswitch-optimize-sequential.snap | 60 ++++++++++++ .../files__simple_loop_unswitch-optimize.snap | 60 ++++++++++++ 33 files changed, 972 insertions(+) rename tests/passing/{ => small}/peggy_comparison/branch_hoisting.bril (100%) rename tests/passing/{ => small}/peggy_comparison/conditional_constant_folding.bril (100%) rename tests/passing/{ => small}/peggy_comparison/dead_loop_deletion.bril (100%) rename tests/passing/{ => small}/peggy_comparison/if_true.bril (100%) rename tests/passing/{ => small}/peggy_comparison/loop_based_code_motion.bril (100%) rename tests/passing/{ => small}/peggy_comparison/loop_invariant_code_motion.bril (100%) rename tests/passing/{ => small}/peggy_comparison/loop_peeling.bril (100%) rename tests/passing/{ => small}/peggy_comparison/loop_strength_reduction.bril (100%) rename tests/passing/{ => small}/peggy_comparison/loop_strength_reduction_modified.bril (100%) rename tests/passing/{ => small}/peggy_comparison/loop_unroll.bril (100%) rename tests/passing/{ => small}/peggy_comparison/simple_loop_unswitch.bril (100%) create mode 100644 tests/snapshots/files__branch_hoisting-optimize-sequential.snap create mode 100644 tests/snapshots/files__branch_hoisting-optimize.snap create mode 100644 tests/snapshots/files__conditional_constant_folding-optimize-sequential.snap create mode 100644 tests/snapshots/files__conditional_constant_folding-optimize.snap create mode 100644 tests/snapshots/files__dead_loop_deletion-optimize-sequential.snap create mode 100644 tests/snapshots/files__dead_loop_deletion-optimize.snap create mode 100644 tests/snapshots/files__if_true-optimize-sequential.snap create mode 100644 tests/snapshots/files__if_true-optimize.snap create mode 100644 tests/snapshots/files__loop_based_code_motion-optimize-sequential.snap create mode 100644 tests/snapshots/files__loop_based_code_motion-optimize.snap create mode 100644 tests/snapshots/files__loop_invariant_code_motion-optimize-sequential.snap create mode 100644 tests/snapshots/files__loop_invariant_code_motion-optimize.snap create mode 100644 tests/snapshots/files__loop_peeling-optimize-sequential.snap create mode 100644 tests/snapshots/files__loop_peeling-optimize.snap create mode 100644 tests/snapshots/files__loop_strength_reduction-optimize-sequential.snap create mode 100644 tests/snapshots/files__loop_strength_reduction-optimize.snap create mode 100644 tests/snapshots/files__loop_strength_reduction_modified-optimize-sequential.snap create mode 100644 tests/snapshots/files__loop_strength_reduction_modified-optimize.snap create mode 100644 tests/snapshots/files__loop_unroll-optimize-sequential.snap create mode 100644 tests/snapshots/files__loop_unroll-optimize.snap create mode 100644 tests/snapshots/files__simple_loop_unswitch-optimize-sequential.snap create mode 100644 tests/snapshots/files__simple_loop_unswitch-optimize.snap diff --git a/tests/passing/peggy_comparison/branch_hoisting.bril b/tests/passing/small/peggy_comparison/branch_hoisting.bril similarity index 100% rename from tests/passing/peggy_comparison/branch_hoisting.bril rename to tests/passing/small/peggy_comparison/branch_hoisting.bril diff --git a/tests/passing/peggy_comparison/conditional_constant_folding.bril b/tests/passing/small/peggy_comparison/conditional_constant_folding.bril similarity index 100% rename from tests/passing/peggy_comparison/conditional_constant_folding.bril rename to tests/passing/small/peggy_comparison/conditional_constant_folding.bril diff --git a/tests/passing/peggy_comparison/dead_loop_deletion.bril b/tests/passing/small/peggy_comparison/dead_loop_deletion.bril similarity index 100% rename from tests/passing/peggy_comparison/dead_loop_deletion.bril rename to tests/passing/small/peggy_comparison/dead_loop_deletion.bril diff --git a/tests/passing/peggy_comparison/if_true.bril b/tests/passing/small/peggy_comparison/if_true.bril similarity index 100% rename from tests/passing/peggy_comparison/if_true.bril rename to tests/passing/small/peggy_comparison/if_true.bril diff --git a/tests/passing/peggy_comparison/loop_based_code_motion.bril b/tests/passing/small/peggy_comparison/loop_based_code_motion.bril similarity index 100% rename from tests/passing/peggy_comparison/loop_based_code_motion.bril rename to tests/passing/small/peggy_comparison/loop_based_code_motion.bril diff --git a/tests/passing/peggy_comparison/loop_invariant_code_motion.bril b/tests/passing/small/peggy_comparison/loop_invariant_code_motion.bril similarity index 100% rename from tests/passing/peggy_comparison/loop_invariant_code_motion.bril rename to tests/passing/small/peggy_comparison/loop_invariant_code_motion.bril diff --git a/tests/passing/peggy_comparison/loop_peeling.bril b/tests/passing/small/peggy_comparison/loop_peeling.bril similarity index 100% rename from tests/passing/peggy_comparison/loop_peeling.bril rename to tests/passing/small/peggy_comparison/loop_peeling.bril diff --git a/tests/passing/peggy_comparison/loop_strength_reduction.bril b/tests/passing/small/peggy_comparison/loop_strength_reduction.bril similarity index 100% rename from tests/passing/peggy_comparison/loop_strength_reduction.bril rename to tests/passing/small/peggy_comparison/loop_strength_reduction.bril diff --git a/tests/passing/peggy_comparison/loop_strength_reduction_modified.bril b/tests/passing/small/peggy_comparison/loop_strength_reduction_modified.bril similarity index 100% rename from tests/passing/peggy_comparison/loop_strength_reduction_modified.bril rename to tests/passing/small/peggy_comparison/loop_strength_reduction_modified.bril diff --git a/tests/passing/peggy_comparison/loop_unroll.bril b/tests/passing/small/peggy_comparison/loop_unroll.bril similarity index 100% rename from tests/passing/peggy_comparison/loop_unroll.bril rename to tests/passing/small/peggy_comparison/loop_unroll.bril diff --git a/tests/passing/peggy_comparison/simple_loop_unswitch.bril b/tests/passing/small/peggy_comparison/simple_loop_unswitch.bril similarity index 100% rename from tests/passing/peggy_comparison/simple_loop_unswitch.bril rename to tests/passing/small/peggy_comparison/simple_loop_unswitch.bril diff --git a/tests/snapshots/files__branch_hoisting-optimize-sequential.snap b/tests/snapshots/files__branch_hoisting-optimize-sequential.snap new file mode 100644 index 000000000..d34b6a306 --- /dev/null +++ b/tests/snapshots/files__branch_hoisting-optimize-sequential.snap @@ -0,0 +1,64 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: 0 +@main(v0: int) { +.b1_: + c2_: int = const 0; + c3_: int = const 500; + v4_: int = id c2_; + v5_: int = id c2_; + v6_: int = id v0; + v7_: int = id c2_; + v8_: int = id c3_; +.b9_: + v10_: bool = lt v5_ v8_; + v11_: int = id v4_; + v12_: int = id v5_; + v13_: int = id v6_; + v14_: int = id v7_; + v15_: int = id v8_; + br v10_ .b16_ .b17_; +.b16_: + v18_: bool = eq v6_ v7_; + c19_: int = const 2; + br v18_ .b20_ .b21_; +.b20_: + v22_: int = mul c19_ v5_; + v23_: int = id v22_; + v24_: int = id v5_; + v25_: int = id v6_; + v26_: int = id v6_; + v27_: int = id v8_; +.b28_: + c29_: int = const 1; + v30_: int = add c29_ v5_; + v11_: int = id v23_; + v12_: int = id v30_; + v13_: int = id v6_; + v14_: int = id v7_; + v15_: int = id v8_; + v4_: int = id v11_; + v5_: int = id v12_; + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + jmp .b9_; +.b21_: + c31_: int = const 3; + v32_: int = mul c31_ v5_; + v23_: int = id v32_; + v24_: int = id v5_; + v25_: int = id v6_; + v26_: int = id v7_; + v27_: int = id v8_; + jmp .b28_; +.b17_: + v4_: int = id v11_; + v5_: int = id v12_; + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + print v4_; +} diff --git a/tests/snapshots/files__branch_hoisting-optimize.snap b/tests/snapshots/files__branch_hoisting-optimize.snap new file mode 100644 index 000000000..d34b6a306 --- /dev/null +++ b/tests/snapshots/files__branch_hoisting-optimize.snap @@ -0,0 +1,64 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: 0 +@main(v0: int) { +.b1_: + c2_: int = const 0; + c3_: int = const 500; + v4_: int = id c2_; + v5_: int = id c2_; + v6_: int = id v0; + v7_: int = id c2_; + v8_: int = id c3_; +.b9_: + v10_: bool = lt v5_ v8_; + v11_: int = id v4_; + v12_: int = id v5_; + v13_: int = id v6_; + v14_: int = id v7_; + v15_: int = id v8_; + br v10_ .b16_ .b17_; +.b16_: + v18_: bool = eq v6_ v7_; + c19_: int = const 2; + br v18_ .b20_ .b21_; +.b20_: + v22_: int = mul c19_ v5_; + v23_: int = id v22_; + v24_: int = id v5_; + v25_: int = id v6_; + v26_: int = id v6_; + v27_: int = id v8_; +.b28_: + c29_: int = const 1; + v30_: int = add c29_ v5_; + v11_: int = id v23_; + v12_: int = id v30_; + v13_: int = id v6_; + v14_: int = id v7_; + v15_: int = id v8_; + v4_: int = id v11_; + v5_: int = id v12_; + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + jmp .b9_; +.b21_: + c31_: int = const 3; + v32_: int = mul c31_ v5_; + v23_: int = id v32_; + v24_: int = id v5_; + v25_: int = id v6_; + v26_: int = id v7_; + v27_: int = id v8_; + jmp .b28_; +.b17_: + v4_: int = id v11_; + v5_: int = id v12_; + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + print v4_; +} diff --git a/tests/snapshots/files__conditional_constant_folding-optimize-sequential.snap b/tests/snapshots/files__conditional_constant_folding-optimize-sequential.snap new file mode 100644 index 000000000..8239f8869 --- /dev/null +++ b/tests/snapshots/files__conditional_constant_folding-optimize-sequential.snap @@ -0,0 +1,10 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: 4 +@main(v0: int) { +.b1_: + c2_: int = const 20; + print c2_; +} diff --git a/tests/snapshots/files__conditional_constant_folding-optimize.snap b/tests/snapshots/files__conditional_constant_folding-optimize.snap new file mode 100644 index 000000000..8239f8869 --- /dev/null +++ b/tests/snapshots/files__conditional_constant_folding-optimize.snap @@ -0,0 +1,10 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: 4 +@main(v0: int) { +.b1_: + c2_: int = const 20; + print c2_; +} diff --git a/tests/snapshots/files__dead_loop_deletion-optimize-sequential.snap b/tests/snapshots/files__dead_loop_deletion-optimize-sequential.snap new file mode 100644 index 000000000..2e37721c0 --- /dev/null +++ b/tests/snapshots/files__dead_loop_deletion-optimize-sequential.snap @@ -0,0 +1,42 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: +@main { +.b0_: + c1_: int = const 2; + c2_: int = const 3; + c3_: int = const 0; + c4_: int = const 1; + c5_: int = const 40; + v6_: int = id c2_; + v7_: int = id c3_; + v8_: int = id c4_; + v9_: int = id c5_; +.b10_: + v11_: bool = lt v7_ v9_; + v12_: int = id v6_; + v13_: int = id v7_; + v14_: int = id v8_; + v15_: int = id v9_; + br v11_ .b16_ .b17_; +.b16_: + v18_: int = add v6_ v8_; + v19_: int = add v7_ v8_; + v12_: int = id v18_; + v13_: int = id v19_; + v14_: int = id v8_; + v15_: int = id v9_; + v6_: int = id v12_; + v7_: int = id v13_; + v8_: int = id v14_; + v9_: int = id v15_; + jmp .b10_; +.b17_: + v6_: int = id v12_; + v7_: int = id v13_; + v8_: int = id v14_; + v9_: int = id v15_; + print c1_; +} diff --git a/tests/snapshots/files__dead_loop_deletion-optimize.snap b/tests/snapshots/files__dead_loop_deletion-optimize.snap new file mode 100644 index 000000000..2e37721c0 --- /dev/null +++ b/tests/snapshots/files__dead_loop_deletion-optimize.snap @@ -0,0 +1,42 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: +@main { +.b0_: + c1_: int = const 2; + c2_: int = const 3; + c3_: int = const 0; + c4_: int = const 1; + c5_: int = const 40; + v6_: int = id c2_; + v7_: int = id c3_; + v8_: int = id c4_; + v9_: int = id c5_; +.b10_: + v11_: bool = lt v7_ v9_; + v12_: int = id v6_; + v13_: int = id v7_; + v14_: int = id v8_; + v15_: int = id v9_; + br v11_ .b16_ .b17_; +.b16_: + v18_: int = add v6_ v8_; + v19_: int = add v7_ v8_; + v12_: int = id v18_; + v13_: int = id v19_; + v14_: int = id v8_; + v15_: int = id v9_; + v6_: int = id v12_; + v7_: int = id v13_; + v8_: int = id v14_; + v9_: int = id v15_; + jmp .b10_; +.b17_: + v6_: int = id v12_; + v7_: int = id v13_; + v8_: int = id v14_; + v9_: int = id v15_; + print c1_; +} diff --git a/tests/snapshots/files__if_true-optimize-sequential.snap b/tests/snapshots/files__if_true-optimize-sequential.snap new file mode 100644 index 000000000..ae1cbd809 --- /dev/null +++ b/tests/snapshots/files__if_true-optimize-sequential.snap @@ -0,0 +1,12 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: 20 +@main(v0: int) { +.b1_: + c2_: int = const 1; + v3_: int = sub v0 c2_; + print v0; + print v3_; +} diff --git a/tests/snapshots/files__if_true-optimize.snap b/tests/snapshots/files__if_true-optimize.snap new file mode 100644 index 000000000..ae1cbd809 --- /dev/null +++ b/tests/snapshots/files__if_true-optimize.snap @@ -0,0 +1,12 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: 20 +@main(v0: int) { +.b1_: + c2_: int = const 1; + v3_: int = sub v0 c2_; + print v0; + print v3_; +} diff --git a/tests/snapshots/files__loop_based_code_motion-optimize-sequential.snap b/tests/snapshots/files__loop_based_code_motion-optimize-sequential.snap new file mode 100644 index 000000000..a33212d97 --- /dev/null +++ b/tests/snapshots/files__loop_based_code_motion-optimize-sequential.snap @@ -0,0 +1,31 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: +@main { +.b0_: + c1_: int = const 0; + c2_: int = const 3; + v3_: int = id c1_; + v4_: int = id c2_; +.b5_: + v6_: bool = lt v3_ v4_; + v7_: int = id v3_; + v8_: int = id v4_; + br v6_ .b9_ .b10_; +.b9_: + c11_: int = const 1; + v12_: int = add c11_ v3_; + v7_: int = id v12_; + v8_: int = id v4_; + v3_: int = id v7_; + v4_: int = id v8_; + jmp .b5_; +.b10_: + v3_: int = id v7_; + v4_: int = id v8_; + c13_: int = const 5; + v14_: int = mul c13_ v3_; + print v14_; +} diff --git a/tests/snapshots/files__loop_based_code_motion-optimize.snap b/tests/snapshots/files__loop_based_code_motion-optimize.snap new file mode 100644 index 000000000..a33212d97 --- /dev/null +++ b/tests/snapshots/files__loop_based_code_motion-optimize.snap @@ -0,0 +1,31 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: +@main { +.b0_: + c1_: int = const 0; + c2_: int = const 3; + v3_: int = id c1_; + v4_: int = id c2_; +.b5_: + v6_: bool = lt v3_ v4_; + v7_: int = id v3_; + v8_: int = id v4_; + br v6_ .b9_ .b10_; +.b9_: + c11_: int = const 1; + v12_: int = add c11_ v3_; + v7_: int = id v12_; + v8_: int = id v4_; + v3_: int = id v7_; + v4_: int = id v8_; + jmp .b5_; +.b10_: + v3_: int = id v7_; + v4_: int = id v8_; + c13_: int = const 5; + v14_: int = mul c13_ v3_; + print v14_; +} diff --git a/tests/snapshots/files__loop_invariant_code_motion-optimize-sequential.snap b/tests/snapshots/files__loop_invariant_code_motion-optimize-sequential.snap new file mode 100644 index 000000000..f924563b9 --- /dev/null +++ b/tests/snapshots/files__loop_invariant_code_motion-optimize-sequential.snap @@ -0,0 +1,63 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: 30 10 +@main(v0: int, v1: int) { +.b2_: + c3_: int = const 0; + c4_: int = const 1; + c5_: int = const 20; + v6_: int = id c3_; + v7_: int = id c4_; + v8_: int = id v1; + v9_: int = id v0; + v10_: int = id c5_; +.b11_: + v12_: bool = lt v6_ v10_; + v13_: int = id v6_; + v14_: int = id v7_; + v15_: int = id v8_; + v16_: int = id v9_; + v17_: int = id v10_; + br v12_ .b18_ .b19_; +.b18_: + v20_: int = mul v10_ v9_; + v21_: bool = lt v20_ v8_; + v22_: int = id v6_; + v23_: int = id v7_; + v24_: int = id v20_; + v25_: int = id v8_; + v26_: int = id v9_; + v27_: int = id v10_; + br v21_ .b28_ .b29_; +.b28_: + v30_: int = add v20_ v7_; + v22_: int = id v6_; + v23_: int = id v7_; + v24_: int = id v30_; + v25_: int = id v8_; + v26_: int = id v9_; + v27_: int = id v10_; +.b29_: + v31_: int = mul v24_ v6_; + print v31_; + v32_: int = add v6_ v7_; + v13_: int = id v32_; + v14_: int = id v7_; + v15_: int = id v8_; + v16_: int = id v9_; + v17_: int = id v10_; + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + v9_: int = id v16_; + v10_: int = id v17_; + jmp .b11_; +.b19_: + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + v9_: int = id v16_; + v10_: int = id v17_; +} diff --git a/tests/snapshots/files__loop_invariant_code_motion-optimize.snap b/tests/snapshots/files__loop_invariant_code_motion-optimize.snap new file mode 100644 index 000000000..f924563b9 --- /dev/null +++ b/tests/snapshots/files__loop_invariant_code_motion-optimize.snap @@ -0,0 +1,63 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: 30 10 +@main(v0: int, v1: int) { +.b2_: + c3_: int = const 0; + c4_: int = const 1; + c5_: int = const 20; + v6_: int = id c3_; + v7_: int = id c4_; + v8_: int = id v1; + v9_: int = id v0; + v10_: int = id c5_; +.b11_: + v12_: bool = lt v6_ v10_; + v13_: int = id v6_; + v14_: int = id v7_; + v15_: int = id v8_; + v16_: int = id v9_; + v17_: int = id v10_; + br v12_ .b18_ .b19_; +.b18_: + v20_: int = mul v10_ v9_; + v21_: bool = lt v20_ v8_; + v22_: int = id v6_; + v23_: int = id v7_; + v24_: int = id v20_; + v25_: int = id v8_; + v26_: int = id v9_; + v27_: int = id v10_; + br v21_ .b28_ .b29_; +.b28_: + v30_: int = add v20_ v7_; + v22_: int = id v6_; + v23_: int = id v7_; + v24_: int = id v30_; + v25_: int = id v8_; + v26_: int = id v9_; + v27_: int = id v10_; +.b29_: + v31_: int = mul v24_ v6_; + print v31_; + v32_: int = add v6_ v7_; + v13_: int = id v32_; + v14_: int = id v7_; + v15_: int = id v8_; + v16_: int = id v9_; + v17_: int = id v10_; + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + v9_: int = id v16_; + v10_: int = id v17_; + jmp .b11_; +.b19_: + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + v9_: int = id v16_; + v10_: int = id v17_; +} diff --git a/tests/snapshots/files__loop_peeling-optimize-sequential.snap b/tests/snapshots/files__loop_peeling-optimize-sequential.snap new file mode 100644 index 000000000..85ec2395e --- /dev/null +++ b/tests/snapshots/files__loop_peeling-optimize-sequential.snap @@ -0,0 +1,35 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: 5 +@main(v0: int) { +.b1_: + c2_: int = const 0; + v3_: int = id c2_; + v4_: int = id c2_; + v5_: int = id v0; +.b6_: + v7_: bool = lt v4_ v5_; + v8_: int = id v3_; + v9_: int = id v4_; + v10_: int = id v5_; + br v7_ .b11_ .b12_; +.b11_: + c13_: int = const 5; + v14_: int = add c13_ v3_; + c15_: int = const 1; + v16_: int = add c15_ v4_; + v8_: int = id v14_; + v9_: int = id v16_; + v10_: int = id v5_; + v3_: int = id v8_; + v4_: int = id v9_; + v5_: int = id v10_; + jmp .b6_; +.b12_: + v3_: int = id v8_; + v4_: int = id v9_; + v5_: int = id v10_; + print v3_; +} diff --git a/tests/snapshots/files__loop_peeling-optimize.snap b/tests/snapshots/files__loop_peeling-optimize.snap new file mode 100644 index 000000000..85ec2395e --- /dev/null +++ b/tests/snapshots/files__loop_peeling-optimize.snap @@ -0,0 +1,35 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: 5 +@main(v0: int) { +.b1_: + c2_: int = const 0; + v3_: int = id c2_; + v4_: int = id c2_; + v5_: int = id v0; +.b6_: + v7_: bool = lt v4_ v5_; + v8_: int = id v3_; + v9_: int = id v4_; + v10_: int = id v5_; + br v7_ .b11_ .b12_; +.b11_: + c13_: int = const 5; + v14_: int = add c13_ v3_; + c15_: int = const 1; + v16_: int = add c15_ v4_; + v8_: int = id v14_; + v9_: int = id v16_; + v10_: int = id v5_; + v3_: int = id v8_; + v4_: int = id v9_; + v5_: int = id v10_; + jmp .b6_; +.b12_: + v3_: int = id v8_; + v4_: int = id v9_; + v5_: int = id v10_; + print v3_; +} diff --git a/tests/snapshots/files__loop_strength_reduction-optimize-sequential.snap b/tests/snapshots/files__loop_strength_reduction-optimize-sequential.snap new file mode 100644 index 000000000..5e5a53e7a --- /dev/null +++ b/tests/snapshots/files__loop_strength_reduction-optimize-sequential.snap @@ -0,0 +1,47 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: +@main { +.b0_: + c1_: int = const 0; + c2_: int = const 1; + c3_: int = const 5; + c4_: int = const 300; + v5_: int = id c1_; + v6_: int = id c2_; + v7_: int = id c1_; + v8_: int = id c3_; + v9_: int = id c4_; +.b10_: + v11_: bool = lt v5_ v9_; + v12_: int = id v5_; + v13_: int = id v6_; + v14_: int = id v7_; + v15_: int = id v8_; + v16_: int = id v9_; + br v11_ .b17_ .b18_; +.b17_: + v19_: int = mul v7_ v8_; + print v19_; + v20_: int = add v5_ v6_; + v21_: int = add v6_ v7_; + v12_: int = id v20_; + v13_: int = id v6_; + v14_: int = id v21_; + v15_: int = id v8_; + v16_: int = id v9_; + v5_: int = id v12_; + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + v9_: int = id v16_; + jmp .b10_; +.b18_: + v5_: int = id v12_; + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + v9_: int = id v16_; +} diff --git a/tests/snapshots/files__loop_strength_reduction-optimize.snap b/tests/snapshots/files__loop_strength_reduction-optimize.snap new file mode 100644 index 000000000..5e5a53e7a --- /dev/null +++ b/tests/snapshots/files__loop_strength_reduction-optimize.snap @@ -0,0 +1,47 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: +@main { +.b0_: + c1_: int = const 0; + c2_: int = const 1; + c3_: int = const 5; + c4_: int = const 300; + v5_: int = id c1_; + v6_: int = id c2_; + v7_: int = id c1_; + v8_: int = id c3_; + v9_: int = id c4_; +.b10_: + v11_: bool = lt v5_ v9_; + v12_: int = id v5_; + v13_: int = id v6_; + v14_: int = id v7_; + v15_: int = id v8_; + v16_: int = id v9_; + br v11_ .b17_ .b18_; +.b17_: + v19_: int = mul v7_ v8_; + print v19_; + v20_: int = add v5_ v6_; + v21_: int = add v6_ v7_; + v12_: int = id v20_; + v13_: int = id v6_; + v14_: int = id v21_; + v15_: int = id v8_; + v16_: int = id v9_; + v5_: int = id v12_; + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + v9_: int = id v16_; + jmp .b10_; +.b18_: + v5_: int = id v12_; + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + v9_: int = id v16_; +} diff --git a/tests/snapshots/files__loop_strength_reduction_modified-optimize-sequential.snap b/tests/snapshots/files__loop_strength_reduction_modified-optimize-sequential.snap new file mode 100644 index 000000000..4bd296ec1 --- /dev/null +++ b/tests/snapshots/files__loop_strength_reduction_modified-optimize-sequential.snap @@ -0,0 +1,94 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: +@main { +.b0_: + c1_: int = const 0; + c2_: int = const 1; + c3_: int = const 3; + c4_: int = const 150; + c5_: int = const 5; + c6_: int = const 300; + v7_: int = id c1_; + v8_: int = id c2_; + v9_: int = id c1_; + v10_: int = id c3_; + v11_: int = id c4_; + v12_: int = id c5_; + v13_: int = id c6_; +.b14_: + v15_: bool = lt v7_ v13_; + v16_: int = id v7_; + v17_: int = id v8_; + v18_: int = id v9_; + v19_: int = id v10_; + v20_: int = id v11_; + v21_: int = id v12_; + v22_: int = id v13_; + br v15_ .b23_ .b24_; +.b23_: + v25_: int = mul v12_ v9_; + print v25_; + v26_: int = add v7_ v8_; + v27_: bool = eq v11_ v7_; + v28_: int = add v8_ v9_; + v29_: int = id v7_; + v30_: int = id v8_; + v31_: int = id v28_; + v32_: int = id v10_; + v33_: int = id v11_; + v34_: int = id v12_; + v35_: int = id v13_; + br v27_ .b36_ .b37_; +.b36_: + v38_: int = add v10_ v28_; + v29_: int = id v7_; + v30_: int = id v8_; + v31_: int = id v38_; + v32_: int = id v10_; + v33_: int = id v7_; + v34_: int = id v12_; + v35_: int = id v13_; + v16_: int = id v26_; + v17_: int = id v8_; + v18_: int = id v31_; + v19_: int = id v10_; + v20_: int = id v11_; + v21_: int = id v12_; + v22_: int = id v13_; + v7_: int = id v16_; + v8_: int = id v17_; + v9_: int = id v18_; + v10_: int = id v19_; + v11_: int = id v20_; + v12_: int = id v21_; + v13_: int = id v22_; + br v15_ .b14_ .b39_; +.b37_: + v16_: int = id v26_; + v17_: int = id v8_; + v18_: int = id v31_; + v19_: int = id v10_; + v20_: int = id v11_; + v21_: int = id v12_; + v22_: int = id v13_; + v7_: int = id v16_; + v8_: int = id v17_; + v9_: int = id v18_; + v10_: int = id v19_; + v11_: int = id v20_; + v12_: int = id v21_; + v13_: int = id v22_; + jmp .b14_; +.b24_: + v7_: int = id v16_; + v8_: int = id v17_; + v9_: int = id v18_; + v10_: int = id v19_; + v11_: int = id v20_; + v12_: int = id v21_; + v13_: int = id v22_; +.b39_: +} diff --git a/tests/snapshots/files__loop_strength_reduction_modified-optimize.snap b/tests/snapshots/files__loop_strength_reduction_modified-optimize.snap new file mode 100644 index 000000000..4bd296ec1 --- /dev/null +++ b/tests/snapshots/files__loop_strength_reduction_modified-optimize.snap @@ -0,0 +1,94 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: +@main { +.b0_: + c1_: int = const 0; + c2_: int = const 1; + c3_: int = const 3; + c4_: int = const 150; + c5_: int = const 5; + c6_: int = const 300; + v7_: int = id c1_; + v8_: int = id c2_; + v9_: int = id c1_; + v10_: int = id c3_; + v11_: int = id c4_; + v12_: int = id c5_; + v13_: int = id c6_; +.b14_: + v15_: bool = lt v7_ v13_; + v16_: int = id v7_; + v17_: int = id v8_; + v18_: int = id v9_; + v19_: int = id v10_; + v20_: int = id v11_; + v21_: int = id v12_; + v22_: int = id v13_; + br v15_ .b23_ .b24_; +.b23_: + v25_: int = mul v12_ v9_; + print v25_; + v26_: int = add v7_ v8_; + v27_: bool = eq v11_ v7_; + v28_: int = add v8_ v9_; + v29_: int = id v7_; + v30_: int = id v8_; + v31_: int = id v28_; + v32_: int = id v10_; + v33_: int = id v11_; + v34_: int = id v12_; + v35_: int = id v13_; + br v27_ .b36_ .b37_; +.b36_: + v38_: int = add v10_ v28_; + v29_: int = id v7_; + v30_: int = id v8_; + v31_: int = id v38_; + v32_: int = id v10_; + v33_: int = id v7_; + v34_: int = id v12_; + v35_: int = id v13_; + v16_: int = id v26_; + v17_: int = id v8_; + v18_: int = id v31_; + v19_: int = id v10_; + v20_: int = id v11_; + v21_: int = id v12_; + v22_: int = id v13_; + v7_: int = id v16_; + v8_: int = id v17_; + v9_: int = id v18_; + v10_: int = id v19_; + v11_: int = id v20_; + v12_: int = id v21_; + v13_: int = id v22_; + br v15_ .b14_ .b39_; +.b37_: + v16_: int = id v26_; + v17_: int = id v8_; + v18_: int = id v31_; + v19_: int = id v10_; + v20_: int = id v11_; + v21_: int = id v12_; + v22_: int = id v13_; + v7_: int = id v16_; + v8_: int = id v17_; + v9_: int = id v18_; + v10_: int = id v19_; + v11_: int = id v20_; + v12_: int = id v21_; + v13_: int = id v22_; + jmp .b14_; +.b24_: + v7_: int = id v16_; + v8_: int = id v17_; + v9_: int = id v18_; + v10_: int = id v19_; + v11_: int = id v20_; + v12_: int = id v21_; + v13_: int = id v22_; +.b39_: +} diff --git a/tests/snapshots/files__loop_unroll-optimize-sequential.snap b/tests/snapshots/files__loop_unroll-optimize-sequential.snap new file mode 100644 index 000000000..06574812d --- /dev/null +++ b/tests/snapshots/files__loop_unroll-optimize-sequential.snap @@ -0,0 +1,28 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: +@main { +.b0_: + c1_: int = const 0; + c2_: int = const 1; + v3_: int = id c1_; + v4_: int = id c2_; +.b5_: + v6_: bool = lt v3_ v4_; + v7_: int = id v3_; + v8_: int = id v4_; + br v6_ .b9_ .b10_; +.b9_: + v11_: int = add v3_ v4_; + v7_: int = id v11_; + v8_: int = id v4_; + v3_: int = id v7_; + v4_: int = id v8_; + jmp .b5_; +.b10_: + v3_: int = id v7_; + v4_: int = id v8_; + print v3_; +} diff --git a/tests/snapshots/files__loop_unroll-optimize.snap b/tests/snapshots/files__loop_unroll-optimize.snap new file mode 100644 index 000000000..06574812d --- /dev/null +++ b/tests/snapshots/files__loop_unroll-optimize.snap @@ -0,0 +1,28 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: +@main { +.b0_: + c1_: int = const 0; + c2_: int = const 1; + v3_: int = id c1_; + v4_: int = id c2_; +.b5_: + v6_: bool = lt v3_ v4_; + v7_: int = id v3_; + v8_: int = id v4_; + br v6_ .b9_ .b10_; +.b9_: + v11_: int = add v3_ v4_; + v7_: int = id v11_; + v8_: int = id v4_; + v3_: int = id v7_; + v4_: int = id v8_; + jmp .b5_; +.b10_: + v3_: int = id v7_; + v4_: int = id v8_; + print v3_; +} diff --git a/tests/snapshots/files__simple_loop_unswitch-optimize-sequential.snap b/tests/snapshots/files__simple_loop_unswitch-optimize-sequential.snap new file mode 100644 index 000000000..09807d1cd --- /dev/null +++ b/tests/snapshots/files__simple_loop_unswitch-optimize-sequential.snap @@ -0,0 +1,60 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: 40 +@main(v0: int) { +.b1_: + c2_: int = const 0; + c3_: int = const 1; + v4_: int = id c2_; + v5_: int = id c2_; + v6_: int = id c3_; + v7_: int = id v0; + v8_: int = id c2_; +.b9_: + v10_: bool = lt v5_ v7_; + v11_: int = id v4_; + v12_: int = id v5_; + v13_: int = id v6_; + v14_: int = id v7_; + v15_: int = id v8_; + br v10_ .b16_ .b17_; +.b16_: + print v5_; + v18_: bool = lt v7_ v8_; + v19_: int = id v4_; + v20_: int = id v5_; + v21_: int = id v6_; + v22_: int = id v7_; + v23_: int = id v8_; + br v18_ .b24_ .b25_; +.b24_: + c26_: int = const 2; + v19_: int = id c26_; + v20_: int = id v5_; + v21_: int = id v6_; + v22_: int = id v7_; + v23_: int = id v8_; +.b25_: + v27_: int = add v19_ v6_; + v28_: int = add v5_ v6_; + v11_: int = id v27_; + v12_: int = id v28_; + v13_: int = id v6_; + v14_: int = id v7_; + v15_: int = id v8_; + v4_: int = id v11_; + v5_: int = id v12_; + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + jmp .b9_; +.b17_: + v4_: int = id v11_; + v5_: int = id v12_; + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + print v4_; +} diff --git a/tests/snapshots/files__simple_loop_unswitch-optimize.snap b/tests/snapshots/files__simple_loop_unswitch-optimize.snap new file mode 100644 index 000000000..09807d1cd --- /dev/null +++ b/tests/snapshots/files__simple_loop_unswitch-optimize.snap @@ -0,0 +1,60 @@ +--- +source: tests/files.rs +expression: visualization.result +--- +# ARGS: 40 +@main(v0: int) { +.b1_: + c2_: int = const 0; + c3_: int = const 1; + v4_: int = id c2_; + v5_: int = id c2_; + v6_: int = id c3_; + v7_: int = id v0; + v8_: int = id c2_; +.b9_: + v10_: bool = lt v5_ v7_; + v11_: int = id v4_; + v12_: int = id v5_; + v13_: int = id v6_; + v14_: int = id v7_; + v15_: int = id v8_; + br v10_ .b16_ .b17_; +.b16_: + print v5_; + v18_: bool = lt v7_ v8_; + v19_: int = id v4_; + v20_: int = id v5_; + v21_: int = id v6_; + v22_: int = id v7_; + v23_: int = id v8_; + br v18_ .b24_ .b25_; +.b24_: + c26_: int = const 2; + v19_: int = id c26_; + v20_: int = id v5_; + v21_: int = id v6_; + v22_: int = id v7_; + v23_: int = id v8_; +.b25_: + v27_: int = add v19_ v6_; + v28_: int = add v5_ v6_; + v11_: int = id v27_; + v12_: int = id v28_; + v13_: int = id v6_; + v14_: int = id v7_; + v15_: int = id v8_; + v4_: int = id v11_; + v5_: int = id v12_; + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + jmp .b9_; +.b17_: + v4_: int = id v11_; + v5_: int = id v12_; + v6_: int = id v13_; + v7_: int = id v14_; + v8_: int = id v15_; + print v4_; +}