[PATCH] D124549: [SimpleLoopUnswitch] Freeze trivial conditions if needed.
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 27 13:17:40 PDT 2022
nikic 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
----------------
fhahn wrote:
> fhahn wrote:
> > 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.
> Forgot to include: https://alive2.llvm.org/ce/z/58vj2Z
Oh right, forgot about the undef case. That's annoying.
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