aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUtils.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@outlook.com>2022-05-25 04:37:51 -0700
committerAlexey Bataev <a.bataev@outlook.com>2022-05-25 13:59:06 -0700
commit10f41a214767219ef369b217f685eb545b80e386 (patch)
treebd6eabdceba04f74bce754e88593a93366e57f48 /llvm/lib/Transforms/Utils/LoopUtils.cpp
parent5520c5839016d1d98d8e01789eb17c910381bd6f (diff)
downloadllvm-10f41a214767219ef369b217f685eb545b80e386.zip
llvm-10f41a214767219ef369b217f685eb545b80e386.tar.gz
llvm-10f41a214767219ef369b217f685eb545b80e386.tar.bz2
[SLP]Fix PR55688: Miscompile due to incorrect nuw/nsw handling.
Need to use all ReductionOps when propagating flags for the reduction ops, otherwise transformation is not correct. Plus, need to drop nuw/nsw flags. Differential Revision: https://reviews.llvm.org/D126371
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUtils.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index cd9e5a8..c5582fb 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -1097,7 +1097,8 @@ Value *llvm::createOrderedReduction(IRBuilderBase &B,
return B.CreateFAddReduce(Start, Src);
}
-void llvm::propagateIRFlags(Value *I, ArrayRef<Value *> VL, Value *OpValue) {
+void llvm::propagateIRFlags(Value *I, ArrayRef<Value *> VL, Value *OpValue,
+ bool IncludeWrapFlags) {
auto *VecOp = dyn_cast<Instruction>(I);
if (!VecOp)
return;
@@ -1106,7 +1107,7 @@ void llvm::propagateIRFlags(Value *I, ArrayRef<Value *> VL, Value *OpValue) {
if (!Intersection)
return;
const unsigned Opcode = Intersection->getOpcode();
- VecOp->copyIRFlags(Intersection);
+ VecOp->copyIRFlags(Intersection, IncludeWrapFlags);
for (auto *V : VL) {
auto *Instr = dyn_cast<Instruction>(V);
if (!Instr)