summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-01-15 16:38:19 +0000
committerSanjay Patel <spatel@rotateright.com>2017-01-15 16:38:19 +0000
commit5f8451afad58906d66c68bf673adacb01e39d86f (patch)
tree1c7b31f4484236f3b2f41a0c74a6da8b99176fda /llvm/lib/Transforms/InstCombine
parentfba2df8d0f21a304f2904fc3baa270badaebadc0 (diff)
downloadbcm5719-llvm-5f8451afad58906d66c68bf673adacb01e39d86f.tar.gz
bcm5719-llvm-5f8451afad58906d66c68bf673adacb01e39d86f.zip
[InstCombine] use m_APInt to allow ashr folds for vectors with splat constants
llvm-svn: 292064
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
index f74e499397e..8453152a448 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
@@ -814,11 +814,12 @@ Instruction *InstCombiner::visitAShr(BinaryOperator &I) {
return R;
unsigned BitWidth = I.getType()->getScalarSizeInBits();
- if (ConstantInt *Op1C = dyn_cast<ConstantInt>(Op1)) {
- unsigned ShAmt = Op1C->getZExtValue();
+ const APInt *ShAmtAPInt;
+ if (match(Op1, m_APInt(ShAmtAPInt))) {
+ unsigned ShAmt = ShAmtAPInt->getZExtValue();
// If the shift amount equals the difference in width of the destination
- // and source types:
+ // and source scalar types:
// ashr (shl (zext X), C), C --> sext X
Value *X;
if (match(Op0, m_Shl(m_ZExt(m_Value(X)), m_Specific(Op1))) &&
OpenPOWER on IntegriCloud