diff options
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUtils.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 14 |
3 files changed, 12 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index 95ae7db..f78ddd0 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -1000,7 +1000,8 @@ Value *llvm::createSimpleTargetReduction(IRBuilderBase &Builder, Value *llvm::createTargetReduction(IRBuilderBase &B, const TargetTransformInfo *TTI, - RecurrenceDescriptor &Desc, Value *Src) { + const RecurrenceDescriptor &Desc, + Value *Src) { // TODO: Support in-order reductions based on the recurrence descriptor. // All ops in the reduction inherit fast-math-flags from the recurrence // descriptor. @@ -1010,8 +1011,8 @@ Value *llvm::createTargetReduction(IRBuilderBase &B, } Value *llvm::createOrderedReduction(IRBuilderBase &B, - RecurrenceDescriptor &Desc, Value *Src, - Value *Start) { + const RecurrenceDescriptor &Desc, + Value *Src, Value *Start) { assert(Desc.getRecurrenceKind() == RecurKind::FAdd && "Unexpected reduction kind"); assert(Src->getType()->isVectorTy() && "Expected a vector type"); diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp index 1c08e77..e97620e 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp @@ -921,7 +921,7 @@ bool LoopVectorizationLegality::canVectorizeFPMath( // have the isOrdered flag set, which indicates that we can move the // reduction operations in-loop. return (all_of(getReductionVars(), [&](auto &Reduction) -> bool { - RecurrenceDescriptor RdxDesc = Reduction.second; + const RecurrenceDescriptor &RdxDesc = Reduction.second; return !RdxDesc.hasExactFPMath() || RdxDesc.isOrdered(); })); } diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index bc745c0..06b415e 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -598,7 +598,7 @@ protected: void fixReduction(VPWidenPHIRecipe *Phi, VPTransformState &State); /// Clear NSW/NUW flags from reduction instructions if necessary. - void clearReductionWrapFlags(RecurrenceDescriptor &RdxDesc, + void clearReductionWrapFlags(const RecurrenceDescriptor &RdxDesc, VPTransformState &State); /// Fixup the LCSSA phi nodes in the unique exit block. This simply @@ -1310,7 +1310,7 @@ public: /// RdxDesc. This is true if the -enable-strict-reductions flag is passed, /// the IsOrdered flag of RdxDesc is set and we do not allow reordering /// of FP operations. - bool useOrderedReductions(RecurrenceDescriptor &RdxDesc) { + bool useOrderedReductions(const RecurrenceDescriptor &RdxDesc) { return EnableStrictReductions && !Hints->allowReordering() && RdxDesc.isOrdered(); } @@ -1515,7 +1515,7 @@ public: /// variables found for the given VF. bool canVectorizeReductions(ElementCount VF) { return (all_of(Legal->getReductionVars(), [&](auto &Reduction) -> bool { - RecurrenceDescriptor RdxDesc = Reduction.second; + const RecurrenceDescriptor &RdxDesc = Reduction.second; return TTI.isLegalToVectorizeReduction(RdxDesc, VF); })); } @@ -4331,7 +4331,7 @@ void InnerLoopVectorizer::fixReduction(VPWidenPHIRecipe *PhiR, // Get it's reduction variable descriptor. assert(Legal->isReductionVariable(OrigPhi) && "Unable to find the reduction variable"); - RecurrenceDescriptor RdxDesc = *PhiR->getRecurrenceDescriptor(); + const RecurrenceDescriptor &RdxDesc = *PhiR->getRecurrenceDescriptor(); RecurKind RK = RdxDesc.getRecurrenceKind(); TrackingVH<Value> ReductionStartValue = RdxDesc.getRecurrenceStartValue(); @@ -4512,7 +4512,7 @@ void InnerLoopVectorizer::fixReduction(VPWidenPHIRecipe *PhiR, OrigPhi->setIncomingValue(IncomingEdgeBlockIdx, LoopExitInst); } -void InnerLoopVectorizer::clearReductionWrapFlags(RecurrenceDescriptor &RdxDesc, +void InnerLoopVectorizer::clearReductionWrapFlags(const RecurrenceDescriptor &RdxDesc, VPTransformState &State) { RecurKind RK = RdxDesc.getRecurrenceKind(); if (RK != RecurKind::Add && RK != RecurKind::Mul) @@ -6273,7 +6273,7 @@ LoopVectorizationCostModel::getSmallestAndWidestTypes() { if (auto *PN = dyn_cast<PHINode>(&I)) { if (!Legal->isReductionVariable(PN)) continue; - RecurrenceDescriptor RdxDesc = Legal->getReductionVars()[PN]; + const RecurrenceDescriptor &RdxDesc = Legal->getReductionVars()[PN]; if (PreferInLoopReductions || useOrderedReductions(RdxDesc) || TTI.preferInLoopReduction(RdxDesc.getOpcode(), RdxDesc.getRecurrenceType(), @@ -7173,7 +7173,7 @@ InstructionCost LoopVectorizationCostModel::getReductionPatternCost( while (!isa<PHINode>(ReductionPhi)) ReductionPhi = InLoopReductionImmediateChains[ReductionPhi]; - RecurrenceDescriptor RdxDesc = + const RecurrenceDescriptor &RdxDesc = Legal->getReductionVars()[cast<PHINode>(ReductionPhi)]; InstructionCost BaseCost = TTI.getArithmeticReductionCost( RdxDesc.getOpcode(), VectorTy, false, CostKind); |