diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-01-15 16:38:19 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-01-15 16:38:19 +0000 |
commit | 5f8451afad58906d66c68bf673adacb01e39d86f (patch) | |
tree | 1c7b31f4484236f3b2f41a0c74a6da8b99176fda /llvm/lib/Transforms | |
parent | fba2df8d0f21a304f2904fc3baa270badaebadc0 (diff) | |
download | bcm5719-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')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp | 7 |
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))) && |