From d381818c9458eb6ed623d0bb62b090246b10d7b8 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sun, 4 Jun 2017 07:30:28 +0000 Subject: [PATCH] [ConstantFolding] Properly support constant folding of vector powi intrinsic. The second argument is not a vector so needs special treatment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304679 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ConstantFolding.cpp | 3 ++- test/Transforms/InstSimplify/call.ll | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index d33fe4a0094..b8e80eaedd9 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -2036,7 +2036,8 @@ Constant *ConstantFoldVectorCall(StringRef Name, unsigned IntrinsicID, for (unsigned J = 0, JE = Operands.size(); J != JE; ++J) { // These intrinsics use a scalar type for their second argument. if (J == 1 && - (IntrinsicID == Intrinsic::cttz || IntrinsicID == Intrinsic::ctlz)) { + (IntrinsicID == Intrinsic::cttz || IntrinsicID == Intrinsic::ctlz || + IntrinsicID == Intrinsic::powi)) { Lane[J] = Operands[J]; continue; } diff --git a/test/Transforms/InstSimplify/call.ll b/test/Transforms/InstSimplify/call.ll index 364fd643691..c7d10e251b4 100644 --- a/test/Transforms/InstSimplify/call.ll +++ b/test/Transforms/InstSimplify/call.ll @@ -437,8 +437,7 @@ entry: define <2 x double> @constant_fold_powi_vec() nounwind uwtable ssp { ; CHECK-LABEL: @constant_fold_powi_vec( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = call <2 x double> @llvm.powi.v2f64(<2 x double> , i32 2) -; CHECK-NEXT: ret <2 x double> [[TMP0]] +; CHECK-NEXT: ret <2 x double> ; entry: %0 = call <2 x double> @llvm.powi.v2f64(<2 x double> , i32 2) -- 2.50.1