Summary
The crasher causes opt_main to time out after 1500 seconds due to an infinite optimization loop between Strength Reduction (strength_reduction_pass.cc) and Array Simplification (array_simplification_pass.cc).
Root Cause
- Strength Reduction (
SinkSingleUserSelect in strength_reduction_pass.cc) sees array_update(array_literal, sel_val, indices=[sel_val]) where sel_val's cases are known constants and the array is constant. It sinks array_update into sel_val, creating sel(cases=[array_update(const0), array_update(const1)]).
- Array Simplification (
array_simplification_pass.cc) detects a select whose cases are all array_update on the same array/index and hoists the select back out, producing array_update(sel(...)).
- The two passes endlessly undo each other in a loop until timeout.
Reproduction Steps
Run opt_main on the unoptimized converted IR from crasher_2026-07-04_500fx:
Minimized IR Reproduction
package test_package
top fn main(s: bits[1]) -> bits[8][2] {
a: bits[8][2] = literal(value=[1, 2])
c0: bits[8] = literal(value=0)
c1: bits[8] = literal(value=1)
sel_val: bits[8] = sel(s, cases=[c0, c1])
ret array_update.1: bits[8][2] = array_update(a, sel_val, indices=[sel_val])
}
Summary
The crasher causes
opt_mainto time out after 1500 seconds due to an infinite optimization loop between Strength Reduction (strength_reduction_pass.cc) and Array Simplification (array_simplification_pass.cc).Root Cause
SinkSingleUserSelectinstrength_reduction_pass.cc) seesarray_update(array_literal, sel_val, indices=[sel_val])wheresel_val's cases are known constants and the array is constant. It sinksarray_updateintosel_val, creatingsel(cases=[array_update(const0), array_update(const1)]).array_simplification_pass.cc) detects a select whose cases are allarray_updateon the same array/index and hoists the select back out, producingarray_update(sel(...)).Reproduction Steps
Run opt_main on the unoptimized converted IR from crasher_2026-07-04_500fx:
Minimized IR Reproduction