[PATCH] D106843: [IVDescriptors] Fix bug in checkOrderedReduction
Anna Thomas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 27 06:31:55 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG68ffed12b7e2: [IVDescriptors] Fix bug in checkOrderedReduction (authored by anna).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106843/new/
https://reviews.llvm.org/D106843
Files:
llvm/lib/Analysis/IVDescriptors.cpp
llvm/test/Transforms/LoopVectorize/fp-reduction-crash.ll
Index: llvm/test/Transforms/LoopVectorize/fp-reduction-crash.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/LoopVectorize/fp-reduction-crash.ll
@@ -0,0 +1,21 @@
+; REQUIRES: asserts
+; RUN: opt < %s -loop-vectorize -S | FileCheck %s
+
+; CHECK-LABEL: quux
+define void @quux() {
+bb:
+ br label %bb4
+
+bb1: ; preds = %bb4
+ %tmp = phi double [ %tmp6, %bb4 ]
+ br i1 undef, label %bb4, label %bb2
+
+bb2: ; preds = %bb1
+ %tmp3 = phi double [ %tmp, %bb1 ]
+ ret void
+
+bb4: ; preds = %bb1, %bb
+ %tmp5 = phi double [ 1.300000e+01, %bb ], [ %tmp, %bb1 ]
+ %tmp6 = fadd double %tmp5, 1.000000e+00
+ br label %bb1
+}
Index: llvm/lib/Analysis/IVDescriptors.cpp
===================================================================
--- llvm/lib/Analysis/IVDescriptors.cpp
+++ llvm/lib/Analysis/IVDescriptors.cpp
@@ -199,16 +199,14 @@
if (Kind != RecurKind::FAdd)
return false;
- bool IsOrdered =
- Exit->getOpcode() == Instruction::FAdd && Exit == ExactFPMathInst;
+ if (Exit->getOpcode() != Instruction::FAdd || Exit != ExactFPMathInst)
+ return false;
// The only pattern accepted is the one in which the reduction PHI
// is used as one of the operands of the exit instruction
auto *LHS = Exit->getOperand(0);
auto *RHS = Exit->getOperand(1);
- IsOrdered &= ((LHS == Phi) || (RHS == Phi));
-
- if (!IsOrdered)
+ if (LHS != Phi && RHS != Phi)
return false;
LLVM_DEBUG(dbgs() << "LV: Found an ordered reduction: Phi: " << *Phi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106843.362009.patch
Type: text/x-patch
Size: 1674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210727/ba90f6ca/attachment.bin>
More information about the llvm-commits
mailing list