Trivial unswitching can also introduce new branches on undef/poison.
Freeze the conditions if needed.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/Transforms/SimpleLoopUnswitch/LIV-loop-condtion.ll | ||
---|---|---|
11 | This freeze doesn't look necessary -- shouldn't there be a "not guaranteed to execute" check involved? |
llvm/test/Transforms/SimpleLoopUnswitch/LIV-loop-condtion.ll | ||
---|---|---|
11 | Unfortunately I think the freeze here is needed due to the branch in the loop using %cond.and = and i1 %cond1, %cond2 as branch condition. %cond1 could be undef and cond2 could always be 0. Then branching on cond1 unconditionally introduces a new branch on undef. (That's not an issue for poison though). I'd need to check if isGuaranteedNotToBeUndefOrPoison does the right thing if the branch condition isn't an AND/OR but just an invariant value. |
llvm/test/Transforms/SimpleLoopUnswitch/LIV-loop-condtion.ll | ||
---|---|---|
11 | Forgot to include: https://alive2.llvm.org/ce/z/58vj2Z |
llvm/test/Transforms/SimpleLoopUnswitch/LIV-loop-condtion.ll | ||
---|---|---|
11 | Oh right, forgot about the undef case. That's annoying. |
This freeze doesn't look necessary -- shouldn't there be a "not guaranteed to execute" check involved?