summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-10-27 05:47:49 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-10-27 05:47:49 +0000
commitc8bdd23acfed7934c58804cb87ed8a43a7a9e20c (patch)
tree31b884c2ef632179e0c4da4003232ef536085290 /llvm/lib
parente853b4f2e42d80156272ebca58a8e92c79d2082a (diff)
downloadbcm5719-llvm-c8bdd23acfed7934c58804cb87ed8a43a7a9e20c.tar.gz
bcm5719-llvm-c8bdd23acfed7934c58804cb87ed8a43a7a9e20c.zip
InstCombine: Fix a combine assuming that icmp operands were integers
An icmp may have pointer arguments, it isn't limited to integers or vectors of integers. This fixes PR21388. llvm-svn: 220664
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index cbcc85944a7..b41cdc65202 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -900,6 +900,10 @@ Instruction *InstCombiner::transformSExtICmp(ICmpInst *ICI, Instruction &CI) {
Value *Op0 = ICI->getOperand(0), *Op1 = ICI->getOperand(1);
ICmpInst::Predicate Pred = ICI->getPredicate();
+ // Don't bother if Op1 isn't of vector or integer type.
+ if (!Op1->getType()->isIntOrIntVectorTy())
+ return nullptr;
+
if (Constant *Op1C = dyn_cast<Constant>(Op1)) {
// (x <s 0) ? -1 : 0 -> ashr x, 31 -> all ones if negative
// (x >s -1) ? -1 : 0 -> not (ashr x, 31) -> all ones if positive
OpenPOWER on IntegriCloud