summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2019-07-15 08:48:47 +0000
committerFlorian Hahn <flo@fhahn.com>2019-07-15 08:48:47 +0000
commit1d554b7441258c8074c912c674f51b1b17625a38 (patch)
tree17d5e77e0faff09c06c343d14dbd35afd14ac797
parent3ed93b4673b98dc58af0d25c4ab33fd2bcf8fca1 (diff)
downloadbcm5719-llvm-1d554b7441258c8074c912c674f51b1b17625a38.tar.gz
bcm5719-llvm-1d554b7441258c8074c912c674f51b1b17625a38.zip
[LoopVectorize] Pass unfiltered list of arguments to getIntrinsicInstCost.
We do not compute the scalarization overhead in getVectorIntrinsicCost and TTI::getIntrinsicInstrCost requires the full arguments list. llvm-svn: 366049
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp7
-rw-r--r--llvm/test/Transforms/LoopVectorize/vector-intrinsic-call-cost.ll30
2 files changed, 32 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 22cf9c7db94..46265e3f3e1 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -3149,11 +3149,8 @@ unsigned LoopVectorizationCostModel::getVectorIntrinsicCost(CallInst *CI,
if (auto *FPMO = dyn_cast<FPMathOperator>(CI))
FMF = FPMO->getFastMathFlags();
- // Skip operands that do not require extraction/scalarization and do not incur
- // any overhead.
- return TTI.getIntrinsicInstrCost(
- ID, CI->getType(), filterExtractingOperands(CI->arg_operands(), VF), FMF,
- VF);
+ SmallVector<Value *, 4> Operands(CI->arg_operands());
+ return TTI.getIntrinsicInstrCost(ID, CI->getType(), Operands, FMF, VF);
}
static Type *smallestIntegerVectorType(Type *T1, Type *T2) {
diff --git a/llvm/test/Transforms/LoopVectorize/vector-intrinsic-call-cost.ll b/llvm/test/Transforms/LoopVectorize/vector-intrinsic-call-cost.ll
new file mode 100644
index 00000000000..fce4d56c2e6
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/vector-intrinsic-call-cost.ll
@@ -0,0 +1,30 @@
+; RUN: opt -S -loop-vectorize -force-vector-width=4 %s | FileCheck %s
+
+; CHECK-LABEL: @test_fshl
+; CHECK-LABEL: vector.body:
+; CHECK-NEXT: %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
+; CHECK-NEXT: %broadcast.splatinsert = insertelement <4 x i32> undef, i32 %index, i32 0
+; CHECK-NEXT: %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
+; CHECK-NEXT: %induction = add <4 x i32> %broadcast.splat, <i32 0, i32 1, i32 2, i32 3>
+; CHECK-NEXT: %0 = add i32 %index, 0
+; CHECK-NEXT: %1 = call <4 x i16> @llvm.fshl.v4i16(<4 x i16> undef, <4 x i16> undef, <4 x i16> <i16 15, i16 15, i16 15, i16 15>)
+; CHECK-NEXT: %index.next = add i32 %index, 4
+; CHECK-NEXT: %2 = icmp eq i32 %index.next, %n.vec
+; CHECK-NEXT: br i1 %2, label %middle.block, label %vector.body, !llvm.loop !0
+;
+define void @test_fshl(i32 %width) {
+entry:
+ br label %for.body9.us.us
+
+for.cond6.for.cond.cleanup8_crit_edge.us.us: ; preds = %for.body9.us.us
+ ret void
+
+for.body9.us.us: ; preds = %for.body9.us.us, %entry
+ %x.020.us.us = phi i32 [ 0, %entry ], [ %inc.us.us, %for.body9.us.us ]
+ %conv4.i.us.us = tail call i16 @llvm.fshl.i16(i16 undef, i16 undef, i16 15)
+ %inc.us.us = add nuw i32 %x.020.us.us, 1
+ %exitcond50 = icmp eq i32 %inc.us.us, %width
+ br i1 %exitcond50, label %for.cond6.for.cond.cleanup8_crit_edge.us.us, label %for.body9.us.us
+}
+
+declare i16 @llvm.fshl.i16(i16, i16, i16)
OpenPOWER on IntegriCloud