[llvm] r304679 - [ConstantFolding] Properly support constant folding of vector powi intrinsic. The second argument is not a vector so needs special treatment.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 4 00:30:29 PDT 2017
Author: ctopper
Date: Sun Jun 4 02:30:28 2017
New Revision: 304679
URL: http://llvm.org/viewvc/llvm-project?rev=304679&view=rev
Log:
[ConstantFolding] Properly support constant folding of vector powi intrinsic. The second argument is not a vector so needs special treatment.
Modified:
llvm/trunk/lib/Analysis/ConstantFolding.cpp
llvm/trunk/test/Transforms/InstSimplify/call.ll
Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=304679&r1=304678&r2=304679&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Sun Jun 4 02:30:28 2017
@@ -2036,7 +2036,8 @@ Constant *ConstantFoldVectorCall(StringR
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;
}
Modified: llvm/trunk/test/Transforms/InstSimplify/call.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/call.ll?rev=304679&r1=304678&r2=304679&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/call.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/call.ll Sun Jun 4 02:30:28 2017
@@ -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> <double 3.000000e+00, double 5.000000e+00>, i32 2)
-; CHECK-NEXT: ret <2 x double> [[TMP0]]
+; CHECK-NEXT: ret <2 x double> <double 9.000000e+00, double 2.500000e+01>
;
entry:
%0 = call <2 x double> @llvm.powi.v2f64(<2 x double> <double 3.00000e+00, double 5.00000e+00>, i32 2)
More information about the llvm-commits
mailing list