Skip no-op block argument prep in C++ backend#394
Merged
Conversation
Emit no "// prepare block arguments" block when a basic block
invocation has no arguments, and skip individual temp/assignment
pairs whose source and target variable already match, avoiding
dead code like empty `{ }` blocks and self-assignments (`var = var;`)
in the generated C++ source.
Contributor
There was a problem hiding this comment.
Tracing Benchmark
Details
| Benchmark suite | Current: b104d86 | Previous: 82fb269 | Ratio |
|---|---|---|---|
e2e_tiered_bc_to_mlir |
3371.33 us (± 101623) |
3406.0899999999997 us (± 102338) |
0.99 |
e2e_single_mlir |
5.63517 ms (± 212.303) |
5.73569 ms (± 169.337) |
0.98 |
trace_add |
2.40515 us (± 266.86) |
2.43874 us (± 201.906) |
0.99 |
completing_trace_add |
2.37267 us (± 232.023) |
2.40176 us (± 207.523) |
0.99 |
trace_ifThenElse |
9.1866 us (± 1.46714) |
9.07879 us (± 1.21039) |
1.01 |
completing_trace_ifThenElse |
4.70287 us (± 453.599) |
4.64144 us (± 466.796) |
1.01 |
trace_deeplyNestedIfElse |
27.1121 us (± 3.06708) |
27.1354 us (± 2.9761) |
1.00 |
completing_trace_deeplyNestedIfElse |
12.9248 us (± 1.14918) |
12.8937 us (± 1.46014) |
1.00 |
trace_loop |
8.97867 us (± 1.11288) |
8.89516 us (± 1.42578) |
1.01 |
completing_trace_loop |
4.83641 us (± 472.146) |
4.79504 us (± 499.492) |
1.01 |
trace_ifInsideLoop |
17.6341 us (± 2.30252) |
17.6284 us (± 2.73253) |
1.00 |
completing_trace_ifInsideLoop |
8.87045 us (± 1.04045) |
8.57876 us (± 1.08184) |
1.03 |
trace_loopDirectCall |
9.08714 us (± 907.621) |
9.2492 us (± 1.63747) |
0.98 |
completing_trace_loopDirectCall |
4.93531 us (± 549.831) |
4.89963 us (± 533.778) |
1.01 |
trace_pointerLoop |
14.9953 us (± 2.13681) |
15.0069 us (± 2.95846) |
1.00 |
completing_trace_pointerLoop |
10.4945 us (± 894.618) |
10.359 us (± 1.52045) |
1.01 |
trace_staticLoop |
7.79184 us (± 573.485) |
7.93877 us (± 800.54) |
0.98 |
completing_trace_staticLoop |
9.12379 us (± 2.4204) |
7.95065 us (± 1.00576) |
1.15 |
trace_fibonacci |
10.4243 us (± 970.568) |
10.5456 us (± 1.95715) |
0.99 |
completing_trace_fibonacci |
6.24119 us (± 462.74) |
6.14505 us (± 707.134) |
1.02 |
trace_gcd |
8.41368 us (± 1.7045) |
8.18018 us (± 1.16695) |
1.03 |
completing_trace_gcd |
4.10964 us (± 410.237) |
4.03747 us (± 501.388) |
1.02 |
trace_nestedIf10 |
45.1315 us (± 3.91088) |
44.9556 us (± 5.86001) |
1.00 |
completing_trace_nestedIf10 |
46.3482 us (± 2.93951) |
45.833 us (± 5.97469) |
1.01 |
trace_nestedIf100 |
1.97816 ms (± 25.242) |
1.97261 ms (± 41.3034) |
1.00 |
completing_trace_nestedIf100 |
2.01475 ms (± 15.8172) |
2.0151 ms (± 46.9436) |
1.00 |
trace_chainedIf10 |
106.662 us (± 6.50578) |
106.78 us (± 9.06965) |
1.00 |
completing_trace_chainedIf10 |
50.9679 us (± 4.19358) |
50.6966 us (± 6.44237) |
1.01 |
trace_chainedIf100 |
5.07984 ms (± 73.1813) |
5.04658 ms (± 32.4822) |
1.01 |
completing_trace_chainedIf100 |
2.41544 ms (± 38.2132) |
2.40643 ms (± 29.1104) |
1.00 |
exec_bc_addOne |
40.8289 ns (± 5.77828) |
43.0194 ns (± 5.24286) |
0.95 |
exec_mlir_addOne |
294.577 ns (± 18.0891) |
297.668 ns (± 11.3804) |
0.99 |
exec_cpp_addOne |
4.03931 ns (± 0.742952) |
3.92746 ns (± 0.291826) |
1.03 |
exec_interpreted_addOne |
38.3138 ns (± 1.8469) |
39.3278 ns (± 2.13151) |
0.97 |
exec_mlir_add |
10.5073 ns (± 1.06853) |
11.0891 ns (± 1.28909) |
0.95 |
exec_mlir_fibonacci |
14.2679 us (± 6.38562) |
13.6824 us (± 1.49736) |
1.04 |
exec_mlir_sum |
581.338 us (± 22.46) |
575.346 us (± 30.3657) |
1.01 |
exec_cpp_add |
4.68554 ns (± 0.793217) |
4.8803 ns (± 1.03444) |
0.96 |
exec_cpp_fibonacci |
48.164 us (± 3.75114) |
50.3194 us (± 8.54567) |
0.96 |
exec_cpp_sum |
11.4104 ms (± 77.6546) |
11.8766 ms (± 1.11927) |
0.96 |
exec_bc_add |
47.709 ns (± 10.7159) |
46.9787 ns (± 6.00974) |
1.02 |
exec_bc_fibonacci |
433.395 us (± 13.9121) |
416.682 us (± 31.7965) |
1.04 |
exec_bc_sum |
97.0871 ms (± 6.78892) |
92.1104 ms (± 1.05409) |
1.05 |
exec_tbc_add |
26.2857 ns (± 2.36062) |
26.9861 ns (± 3.44593) |
0.97 |
exec_tbc_fibonacci |
144.39 us (± 8.39014) |
143.308 us (± 7.23907) |
1.01 |
exec_tbc_sum |
36.5801 ms (± 100.8) |
36.8853 ms (± 794.846) |
0.99 |
exec_asmjit_add |
3.45149 ns (± 0.232939) |
3.56907 ns (± 0.643297) |
0.97 |
exec_asmjit_fibonacci |
14.2969 us (± 1.3414) |
14.403 us (± 2.03653) |
0.99 |
exec_asmjit_sum |
2.80204 ms (± 24.7128) |
2.8224 ms (± 52.0688) |
0.99 |
exec_bc_add_passesOff |
46.3091 ns (± 4.81958) |
46.9348 ns (± 6.47854) |
0.99 |
exec_bc_add_passesOn |
46.2716 ns (± 5.75467) |
46.7939 ns (± 6.59386) |
0.99 |
exec_bc_fibonacci_passesOff |
431.605 us (± 12.5213) |
416.498 us (± 26.1534) |
1.04 |
exec_bc_fibonacci_passesOn |
395.113 us (± 19.0426) |
372.555 us (± 11.3273) |
1.06 |
exec_bc_sum_passesOff |
95.2796 ms (± 497.568) |
92.1032 ms (± 1.72355) |
1.03 |
exec_bc_sum_passesOn |
79.7557 ms (± 144.698) |
78.5211 ms (± 1.09825) |
1.02 |
exec_tbc_add_passesOff |
26.6882 ns (± 2.85125) |
26.4166 ns (± 2.52355) |
1.01 |
exec_tbc_add_passesOn |
26.6409 ns (± 3.22472) |
26.4812 ns (± 2.47872) |
1.01 |
exec_tbc_fibonacci_passesOff |
144.404 us (± 8.40551) |
144.161 us (± 7.99194) |
1.00 |
exec_tbc_fibonacci_passesOn |
143.758 us (± 7.026) |
142.926 us (± 7.36484) |
1.01 |
exec_tbc_sum_passesOff |
36.5159 ms (± 66.6224) |
36.8563 ms (± 801.897) |
0.99 |
exec_tbc_sum_passesOn |
33.975 ms (± 98.7026) |
34.298 ms (± 696.237) |
0.99 |
exec_asmjit_add_passesOff |
3.58356 ns (± 0.692906) |
3.53027 ns (± 0.530356) |
1.02 |
exec_asmjit_add_passesOn |
3.51474 ns (± 0.457129) |
3.51767 ns (± 0.441296) |
1.00 |
exec_asmjit_fibonacci_passesOff |
14.2986 us (± 1.49559) |
14.6271 us (± 3.60155) |
0.98 |
exec_asmjit_fibonacci_passesOn |
14.5896 us (± 2.39468) |
14.5669 us (± 2.12316) |
1.00 |
exec_asmjit_sum_passesOff |
2.80793 ms (± 40.6079) |
2.82394 ms (± 124.579) |
0.99 |
exec_asmjit_sum_passesOn |
2.79779 ms (± 15.065) |
2.80829 ms (± 37.1071) |
1.00 |
exec_bc_add_noRegAlloc |
46.4466 ns (± 4.94694) |
48.0593 ns (± 10.3702) |
0.97 |
exec_bc_add_regAlloc |
47.551 ns (± 8.79225) |
45.8625 ns (± 3.60727) |
1.04 |
exec_bc_fibonacci_noRegAlloc |
433.259 us (± 15.0468) |
414.714 us (± 16.5379) |
1.04 |
exec_bc_fibonacci_regAlloc |
431.071 us (± 9.89671) |
412.16 us (± 11.3568) |
1.05 |
exec_bc_sum_noRegAlloc |
95.5019 ms (± 296.535) |
98.5292 ms (± 1.96292) |
0.97 |
exec_bc_sum_regAlloc |
96.774 ms (± 6.26775) |
92.1645 ms (± 672.302) |
1.05 |
exec_bc_add_call |
46.9122 ns (± 10.2741) |
47.1272 ns (± 6.29866) |
1.00 |
exec_bc_add_switch |
42.9547 ns (± 5.88605) |
45.8396 ns (± 0.700939) |
0.94 |
exec_bc_add_threaded |
39.4474 ns (± 6.02756) |
41.3235 ns (± 4.35158) |
0.95 |
exec_bc_fibonacci_call |
432.284 us (± 10.903) |
414.506 us (± 24.1117) |
1.04 |
exec_bc_fibonacci_switch |
348.686 us (± 29.5724) |
402.89 us (± 11.7876) |
0.87 |
exec_bc_fibonacci_threaded |
436.475 us (± 11.5332) |
440.376 us (± 18.8169) |
0.99 |
exec_bc_sum_call |
95.541 ms (± 487.764) |
93.0052 ms (± 5.04147) |
1.03 |
exec_bc_sum_switch |
73.81 ms (± 4.12002) |
90.1329 ms (± 2.36414) |
0.82 |
exec_bc_sum_threaded |
86.6485 ms (± 666.13) |
87.8752 ms (± 978.677) |
0.99 |
exec_bc_add_threaded_noReuse |
39.8135 ns (± 5.02004) |
41.865 ns (± 4.25438) |
0.95 |
exec_bc_add_threaded_reuse |
36.3151 ns (± 5.47046) |
34.6397 ns (± 3.49756) |
1.05 |
exec_bc_fibonacci_threaded_noReuse |
435.732 us (± 10.5625) |
440.417 us (± 14.9244) |
0.99 |
exec_bc_fibonacci_threaded_reuse |
435.763 us (± 11.2194) |
438.549 us (± 13.4611) |
0.99 |
exec_bc_sum_threaded_noReuse |
86.5647 ms (± 923.18) |
88.0156 ms (± 1.12755) |
0.98 |
exec_bc_sum_threaded_reuse |
86.3999 ms (± 261.724) |
87.6104 ms (± 210.369) |
0.99 |
exec_bc_add_threaded_noSuperinstr |
38.5062 ns (± 3.61281) |
42.1763 ns (± 5.9961) |
0.91 |
exec_bc_add_threaded_superinstr |
38.8952 ns (± 4.95915) |
42.6106 ns (± 9.11891) |
0.91 |
comp_mlir_add |
5.72117 ms (± 461.175) |
5.81627 ms (± 288.781) |
0.98 |
comp_mlir_ifThenElse |
6.27028 ms (± 226.732) |
6.23678 ms (± 173.738) |
1.01 |
comp_mlir_deeplyNestedIfElse |
5.3325 ms (± 209.21) |
5.1839 ms (± 182.464) |
1.03 |
comp_mlir_loop |
7.13521 ms (± 144.219) |
7.42778 ms (± 330.429) |
0.96 |
comp_mlir_ifInsideLoop |
29.048 ms (± 735.534) |
30.0164 ms (± 779.954) |
0.97 |
comp_mlir_loopDirectCall |
12.3458 ms (± 314.822) |
12.1943 ms (± 413.091) |
1.01 |
comp_mlir_pointerLoop |
28.5715 ms (± 590.291) |
29.0414 ms (± 760.069) |
0.98 |
comp_mlir_staticLoop |
4.99257 ms (± 58.1272) |
5.10011 ms (± 131.712) |
0.98 |
comp_mlir_fibonacci |
10.7306 ms (± 211.019) |
10.9994 ms (± 373.74) |
0.98 |
comp_mlir_gcd |
9.42451 ms (± 161.772) |
9.81166 ms (± 364.393) |
0.96 |
comp_mlir_nestedIf10 |
10.5271 ms (± 231.557) |
10.8619 ms (± 325.226) |
0.97 |
comp_mlir_nestedIf100 |
25.0877 ms (± 443.54) |
25.9364 ms (± 690.5) |
0.97 |
comp_mlir_chainedIf10 |
9.73925 ms (± 273.862) |
9.82313 ms (± 284.545) |
0.99 |
comp_mlir_chainedIf100 |
20.8882 ms (± 518.841) |
20.8615 ms (± 373.238) |
1.00 |
comp_cpp_add |
24.7359 ms (± 739.077) |
||
comp_cpp_ifThenElse |
25.0767 ms (± 369.304) |
||
comp_cpp_deeplyNestedIfElse |
25.7423 ms (± 502.392) |
||
comp_cpp_loop |
25.2232 ms (± 526.427) |
||
comp_cpp_ifInsideLoop |
26.266 ms (± 655.884) |
||
comp_cpp_loopDirectCall |
25.4545 ms (± 636.476) |
||
comp_cpp_pointerLoop |
25.3842 ms (± 518.709) |
||
comp_cpp_staticLoop |
25.17 ms (± 339.506) |
||
comp_cpp_fibonacci |
25.2253 ms (± 524.15) |
||
comp_cpp_gcd |
24.8395 ms (± 442.554) |
||
comp_cpp_nestedIf10 |
27.6546 ms (± 590.969) |
||
comp_cpp_nestedIf100 |
52.8089 ms (± 822.774) |
||
comp_cpp_chainedIf10 |
27.6195 ms (± 342.522) |
||
comp_cpp_chainedIf100 |
57.147 ms (± 776.525) |
||
comp_bc_add |
15.3372 us (± 2.40358) |
||
comp_bc_ifThenElse |
20.1575 us (± 3.39322) |
||
comp_bc_deeplyNestedIfElse |
25.8098 us (± 4.32413) |
||
comp_bc_loop |
20.6367 us (± 3.03755) |
||
comp_bc_ifInsideLoop |
24.4097 us (± 3.77959) |
||
comp_bc_loopDirectCall |
21.2166 us (± 2.54074) |
||
comp_bc_pointerLoop |
22.6614 us (± 3.64656) |
||
comp_bc_staticLoop |
18.5656 us (± 2.24008) |
||
comp_bc_fibonacci |
21.4156 us (± 4.65148) |
||
comp_bc_gcd |
20.3968 us (± 3.55199) |
||
comp_bc_nestedIf10 |
48.7335 us (± 6.38291) |
||
comp_bc_nestedIf100 |
273.562 us (± 11.6999) |
||
comp_bc_chainedIf10 |
63.9792 us (± 7.92226) |
||
comp_bc_chainedIf100 |
453.911 us (± 17.7368) |
||
comp_tbc_add |
1.88038 us (± 160.532) |
||
comp_tbc_ifThenElse |
4.22105 us (± 488.738) |
||
comp_tbc_deeplyNestedIfElse |
9.57246 us (± 1.11554) |
||
comp_tbc_loop |
4.29038 us (± 556.897) |
||
comp_tbc_ifInsideLoop |
7.25096 us (± 685.238) |
||
comp_tbc_loopDirectCall |
4.52771 us (± 506.508) |
||
comp_tbc_pointerLoop |
5.43304 us (± 450.53) |
||
comp_tbc_staticLoop |
4.55081 us (± 415.887) |
||
comp_tbc_fibonacci |
4.63879 us (± 499.929) |
||
comp_tbc_gcd |
3.78425 us (± 265.475) |
||
comp_tbc_nestedIf10 |
26.0752 us (± 2.66909) |
||
comp_tbc_nestedIf100 |
276.918 us (± 28.5214) |
||
comp_tbc_chainedIf10 |
33.5773 us (± 2.86981) |
||
comp_tbc_chainedIf100 |
399.666 us (± 12.2215) |
||
comp_asmjit_add |
24.4091 us (± 3.83076) |
||
comp_asmjit_ifThenElse |
33.1929 us (± 4.28147) |
||
comp_asmjit_deeplyNestedIfElse |
49.7454 us (± 7.26302) |
||
comp_asmjit_loop |
33.4064 us (± 3.90454) |
||
comp_asmjit_ifInsideLoop |
49.673 us (± 9.319) |
||
comp_asmjit_loopDirectCall |
44.1591 us (± 7.79761) |
||
comp_asmjit_pointerLoop |
46.9271 us (± 8.41669) |
||
comp_asmjit_staticLoop |
29.5226 us (± 4.46789) |
||
comp_asmjit_fibonacci |
35.136 us (± 4.64428) |
||
comp_asmjit_gcd |
34.4007 us (± 3.67651) |
||
comp_asmjit_nestedIf10 |
75.885 us (± 6.99776) |
||
comp_asmjit_nestedIf100 |
493.332 us (± 13.5603) |
||
comp_asmjit_chainedIf10 |
94.989 us (± 8.60131) |
||
comp_asmjit_chainedIf100 |
643.444 us (± 15.6157) |
||
ssa_add |
174.31 ns (± 7.35106) |
176.932 ns (± 15.0243) |
0.99 |
ssa_ifThenElse |
438.901 ns (± 32.3168) |
445.212 ns (± 46.1463) |
0.99 |
ssa_deeplyNestedIfElse |
1.11258 us (± 55.8386) |
1.0974 us (± 82.5486) |
1.01 |
ssa_loop |
474.481 ns (± 32.6682) |
469.649 ns (± 34.2229) |
1.01 |
ssa_ifInsideLoop |
885.605 ns (± 63.3305) |
862.936 ns (± 123.466) |
1.03 |
ssa_loopDirectCall |
481.775 ns (± 69.7475) |
479.092 ns (± 57.3376) |
1.01 |
ssa_pointerLoop |
579.289 ns (± 34.7958) |
577.077 ns (± 66.8387) |
1.00 |
ssa_staticLoop |
396.305 ns (± 19.0549) |
388.429 ns (± 37.5252) |
1.02 |
ssa_fibonacci |
487.48 ns (± 30.9309) |
496.64 ns (± 41.3945) |
0.98 |
ssa_gcd |
440.219 ns (± 33.8156) |
444.463 ns (± 35.7022) |
0.99 |
tiered_twotier_addOne |
3.32343 ms (± 41.4369) |
3.40191 ms (± 107.04) |
0.98 |
tiered_singletier_addOne |
3.25277 ms (± 45.1698) |
3.31811 ms (± 102.918) |
0.98 |
single_compile_mlir_addOne |
3.27117 ms (± 80.1142) |
3.40857 ms (± 128.619) |
0.96 |
single_compile_cpp_addOne |
25.1677 ms (± 689.244) |
26.2292 ms (± 995.197) |
0.96 |
single_compile_bc_addOne |
74.6458 us (± 14.3386) |
75.4549 us (± 13.6871) |
0.99 |
tiered_twotier_sumLoop |
5.38809 ms (± 51.1499) |
5.62886 ms (± 657.458) |
0.96 |
tiered_singletier_sumLoop |
5.30809 ms (± 97.0317) |
5.48231 ms (± 127.496) |
0.97 |
single_compile_mlir_sumLoop |
5.36224 ms (± 270.404) |
5.49151 ms (± 156.987) |
0.98 |
single_compile_cpp_sumLoop |
26.2119 ms (± 1.18242) |
27.4272 ms (± 640.501) |
0.96 |
single_compile_bc_sumLoop |
133.113 us (± 17.6373) |
137.886 us (± 19.3456) |
0.97 |
ir_add |
751.824 ns (± 32.5411) |
724.919 ns (± 59.5063) |
1.04 |
ir_ifThenElse |
1.62185 us (± 101.722) |
1.53201 us (± 113.124) |
1.06 |
ir_deeplyNestedIfElse |
3.36466 us (± 232.41) |
3.29891 us (± 255.637) |
1.02 |
ir_loop |
1.71702 us (± 232.061) |
1.60113 us (± 110.008) |
1.07 |
ir_ifInsideLoop |
2.86636 us (± 226.466) |
2.7779 us (± 168.035) |
1.03 |
ir_loopDirectCall |
1.83883 us (± 131.719) |
1.7725 us (± 143.418) |
1.04 |
ir_pointerLoop |
2.015 us (± 148.065) |
1.95815 us (± 109.49) |
1.03 |
ir_staticLoop |
1.50905 us (± 121.114) |
1.39177 us (± 94.7037) |
1.08 |
ir_fibonacci |
1.77362 us (± 87.2634) |
1.72703 us (± 147.227) |
1.03 |
ir_gcd |
1.53306 us (± 113.547) |
1.47955 us (± 134.735) |
1.04 |
ir_nestedIf10 |
7.64765 us (± 680.703) |
7.62961 us (± 777.825) |
1.00 |
ir_nestedIf100 |
88.433 us (± 8.19817) |
86.906 us (± 6.64684) |
1.02 |
ir_chainedIf10 |
11.7158 us (± 898.266) |
11.5424 us (± 1.02617) |
1.02 |
ir_chainedIf100 |
166.718 us (± 10.5614) |
164.418 us (± 10.5542) |
1.01 |
This comment was automatically generated by workflow using github-action-benchmark.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Emit no "// prepare block arguments" block when a basic block
invocation has no arguments, and skip individual temp/assignment
pairs whose source and target variable already match, avoiding
dead code like empty
{ }blocks and self-assignments (var = var;)in the generated C++ source.