google / souper

A superoptimizer for LLVM IR
Apache License 2.0
2.11k stars 167 forks source link

Default to evaluating first argument of phi #844

Closed manasij7479 closed 2 years ago

manasij7479 commented 3 years ago

Fixes the following crash. This takes a long time to complete when it doesn't crash, so I'm not adding a regression test. Even with the skip-solver option, just generating+pruning guesses takes minutes. This is suspicious, and has to be looked at.

./souper-check -solver-timeout=15 -infer-rhs -souper-double-check -souper-enumerative-synthesis-max-instructions=2 foo.opt -souper-dataflow-pruning %0 = block 2 %1 = block 3 %2 = block 3 %3:i32 = phi %2, 0:i32, 1:i32, 1:i32 %4:i32 = phi %1, %3, 1:i32, 1:i32 %5:i32 = phi %2, 0:i32, 0:i32, 1:i32 %6:i32 = addnw 1:i32, %5 %7:i32 = phi %1, %5, %5, %6 %8:i1 = eq 1:i32, %7 %9:i32 = zext %8 %10:i32 = addnw %4, %9 %11:i32 = phi %0, %10, 0:i32 %12:i1 = eq 2:i32, %11 infer %12

regehr commented 3 years ago

you need to add the test case and, if it's too slow, protect it behind one of our "slow test" flags