summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-06-03 18:50:29 +0000
committerCraig Topper <craig.topper@gmail.com>2017-06-03 18:50:29 +0000
commit7c553edcedca1c085af33906eb4549114da21f34 (patch)
tree8b3c021013b0c0380142c57d8bdef46dd992189c /llvm/lib/Analysis
parent36fa2f0dee480b4fcc3de67ee881faac7709a2a9 (diff)
downloadbcm5719-llvm-7c553edcedca1c085af33906eb4549114da21f34.tar.gz
bcm5719-llvm-7c553edcedca1c085af33906eb4549114da21f34.zip
[ConstantFolding] Fix constant folding for vector cttz and ctlz intrinsics to understand that the second argument is still a scalar.
llvm-svn: 304668
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index a906770dbb3..d33fe4a0094 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -2034,6 +2034,13 @@ Constant *ConstantFoldVectorCall(StringRef Name, unsigned IntrinsicID,
for (unsigned I = 0, E = VTy->getNumElements(); I != E; ++I) {
// Gather a column of constants.
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)) {
+ Lane[J] = Operands[J];
+ continue;
+ }
+
Constant *Agg = Operands[J]->getAggregateElement(I);
if (!Agg)
return nullptr;
OpenPOWER on IntegriCloud