diff options
author | Alexey Bataev <a.bataev@outlook.com> | 2024-07-10 03:55:25 -0700 |
---|---|---|
committer | Alexey Bataev <a.bataev@outlook.com> | 2024-07-10 03:58:00 -0700 |
commit | 3742c2a83cd644c47db969b6dd421665695f94da (patch) | |
tree | 1e1de7677e54cdd91f17320e28b0fbd2213e4816 /llvm/lib | |
parent | 08ce14732d528ab70309f334446d39782f2f07c0 (diff) | |
download | llvm-3742c2a83cd644c47db969b6dd421665695f94da.zip llvm-3742c2a83cd644c47db969b6dd421665695f94da.tar.gz llvm-3742c2a83cd644c47db969b6dd421665695f94da.tar.bz2 |
[SLP]Use stored signedness after minbitwidth analysis.
Need to used stored signedness info for the root node instead of
recalculating it after the vectorization, which may lead to a compiler
crash.
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 1e9dd8c..19353ff 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -17476,9 +17476,8 @@ public: // Emit code to correctly handle reused reduced values, if required. if (OptReusedScalars && !SameScaleFactor) { - VectorizedRoot = - emitReusedOps(VectorizedRoot, Builder, V.getRootNodeScalars(), - SameValuesCounter, TrackedToOrig); + VectorizedRoot = emitReusedOps(VectorizedRoot, Builder, V, + SameValuesCounter, TrackedToOrig); } Value *ReducedSubTree = @@ -17818,24 +17817,19 @@ private: /// Emits actual operation for the scalar identity values, found during /// horizontal reduction analysis. Value *emitReusedOps(Value *VectorizedValue, IRBuilderBase &Builder, - ArrayRef<Value *> VL, + BoUpSLP &R, const MapVector<Value *, unsigned> &SameValuesCounter, const DenseMap<Value *, Value *> &TrackedToOrig) { assert(IsSupportedHorRdxIdentityOp && "The optimization of matched scalar identity horizontal reductions " "must be supported."); + ArrayRef<Value *> VL = R.getRootNodeScalars(); auto *VTy = cast<FixedVectorType>(VectorizedValue->getType()); if (VTy->getElementType() != VL.front()->getType()) { VectorizedValue = Builder.CreateIntCast( VectorizedValue, getWidenedType(VL.front()->getType(), VTy->getNumElements()), - any_of(VL, [&](Value *R) { - KnownBits Known = computeKnownBits( - R, cast<Instruction>(ReductionOps.front().front()) - ->getModule() - ->getDataLayout()); - return !Known.isNonNegative(); - })); + R.isSignedMinBitwidthRootNode()); } switch (RdxKind) { case RecurKind::Add: { |