From 5e6bfb661e8b51b440eda04d0be0c9a00b8713e9 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 11 Jun 2021 10:19:37 +0100 Subject: [Analysis] Pass RecurrenceDescriptor as const reference. NFCI. We were passing the RecurrenceDescriptor by value to most of the reduction analysis methods, despite it being rather bulky with TrackingVH members (that can be costly to copy). In all these cases we're only using the RecurrenceDescriptor for rather basic purposes (access to types/kinds etc.). Differential Revision: https://reviews.llvm.org/D104029 --- llvm/lib/Transforms/Utils/LoopUtils.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp') 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"); -- cgit v1.1