aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-08-19 16:12:16 +0000
committerSanjay Patel <spatel@rotateright.com>2016-08-19 16:12:16 +0000
commita867afe094098d546256d5cb136117007dae5dfc (patch)
tree328a2828f3f7b383865febdc27cd669a853c633c /llvm/lib/Transforms
parentdddb097a1fac41bc75ed442b60989ea33a92bf0a (diff)
downloadllvm-a867afe094098d546256d5cb136117007dae5dfc.zip
llvm-a867afe094098d546256d5cb136117007dae5dfc.tar.gz
llvm-a867afe094098d546256d5cb136117007dae5dfc.tar.bz2
[InstCombine] use m_APInt to allow icmp (shl 1, Y), C folds for splat constant vectors
llvm-svn: 279266
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 41106cd..262c86c 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -1988,15 +1988,16 @@ static Instruction *foldICmpShlOne(ICmpInst &Cmp, Instruction *Shl,
Instruction *InstCombiner::foldICmpShlConstant(ICmpInst &ICI, Instruction *LHSI,
const APInt *RHSV) {
+ // FIXME: This should use m_APInt to allow splat vectors.
+ ConstantInt *ShAmt = dyn_cast<ConstantInt>(LHSI->getOperand(1));
+ if (!ShAmt)
+ return foldICmpShlOne(ICI, LHSI, RHSV);
+
// FIXME: This check restricts all folds under here to scalar types.
ConstantInt *RHS = dyn_cast<ConstantInt>(ICI.getOperand(1));
if (!RHS)
return nullptr;
- ConstantInt *ShAmt = dyn_cast<ConstantInt>(LHSI->getOperand(1));
- if (!ShAmt)
- return foldICmpShlOne(ICI, LHSI, RHSV);
-
// Check that the shift amount is in range. If not, don't perform
// undefined shifts. When the shift is visited it will be
// simplified.