[PATCH] D124549: [SimpleLoopUnswitch] Freeze trivial conditions if needed.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 27 13:13:41 PDT 2022
fhahn marked an inline comment as done.
fhahn added inline comments.
================
Comment at: llvm/test/Transforms/SimpleLoopUnswitch/LIV-loop-condtion.ll:11
; CHECK-NEXT: entry:
-; CHECK-NEXT: br i1 %cond1, label %entry.split, label %loop_exit.split
+; CHECK-NEXT: [[FROZEN:%.+]] = freeze i1 %cond1
+; CHECK-NEXT: br i1 [[FROZEN]], label %entry.split, label %loop_exit.split
----------------
nikic wrote:
> This freeze doesn't look necessary -- shouldn't there be a "not guaranteed to execute" check involved?
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.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124549/new/
https://reviews.llvm.org/D124549
More information about the llvm-commits
mailing list