diff options
author | Nikita Popov <npopov@redhat.com> | 2023-04-27 11:25:40 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2023-04-27 11:25:40 +0200 |
commit | 19732a3eaa978f2c65c233a97593b09e43a618cc (patch) | |
tree | 6b5577d01c149dc869686786e39fe88814b0fe74 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 3690e1f8a7b49feb3e530c062136f9a801a829b1 (diff) | |
download | llvm-19732a3eaa978f2c65c233a97593b09e43a618cc.zip llvm-19732a3eaa978f2c65c233a97593b09e43a618cc.tar.gz llvm-19732a3eaa978f2c65c233a97593b09e43a618cc.tar.bz2 |
[SCEV] Check correct binary operator for nowrap flags
We should be checking the current BO here, not the nested one. If
the current BO has nowrap flags (and is UB on poison), then we'll
fetch both operand SCEVs of that BO. We'll check the nested BO
on the next iteration of the do/while loop.
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 861dea2..d82ffe5 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -7452,8 +7452,8 @@ ScalarEvolution::getOperandsToCreate(Value *V, SmallVectorImpl<Value *> &Ops) { } // CreateSCEV calls getNoWrapFlagsFromUB, which under certain conditions // requires a SCEV for the LHS. - if (NewBO->Op && (NewBO->IsNSW || NewBO->IsNUW)) { - auto *I = dyn_cast<Instruction>(NewBO->Op); + if (BO->Op && (BO->IsNSW || BO->IsNUW)) { + auto *I = dyn_cast<Instruction>(BO->Op); if (I && programUndefinedIfPoison(I)) { Ops.push_back(BO->LHS); break; |