[llvm] 19732a3 - [SCEV] Check correct binary operator for nowrap flags
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 27 02:27:47 PDT 2023
Author: Nikita Popov
Date: 2023-04-27T11:25:40+02:00
New Revision: 19732a3eaa978f2c65c233a97593b09e43a618cc
URL: https://github.com/llvm/llvm-project/commit/19732a3eaa978f2c65c233a97593b09e43a618cc
DIFF: https://github.com/llvm/llvm-project/commit/19732a3eaa978f2c65c233a97593b09e43a618cc.diff
LOG: [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.
Added:
Modified:
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 861dea21f49b..d82ffe52c4cb 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;
More information about the llvm-commits
mailing list