summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-08-04 15:19:25 +0000
committerSanjay Patel <spatel@rotateright.com>2016-08-04 15:19:25 +0000
commit9d591d15ec724bf9eb7652c980dbf936fcfef3ce (patch)
tree3099e5465a082e9f5452ecb1879197bb39cb4ed0 /llvm/lib
parentd1f4b8f6e8eb3d0f2459d78fa98eaef09a51b42b (diff)
downloadbcm5719-llvm-9d591d15ec724bf9eb7652c980dbf936fcfef3ce.tar.gz
bcm5719-llvm-9d591d15ec724bf9eb7652c980dbf936fcfef3ce.zip
[InstCombine] use m_APInt to allow icmp eq (sub C1, X), C2 folds for splat constant vectors
llvm-svn: 277731
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 6a798f91759..4dc1bb0f83c 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -2265,11 +2265,11 @@ Instruction *InstCombiner::foldICmpEqualityWithConstant(ICmpInst &ICI) {
break;
case Instruction::Sub:
if (BO->hasOneUse()) {
- // FIXME: Vectors are excluded by ConstantInt.
- if (ConstantInt *BOp0C = dyn_cast<ConstantInt>(BOp0)) {
+ const APInt *BOC;
+ if (match(BOp0, m_APInt(BOC))) {
// Replace ((sub A, B) != C) with (B != A-C) if A & C are constants.
- return new ICmpInst(ICI.getPredicate(), BOp1,
- ConstantExpr::getSub(BOp0C, RHS));
+ Constant *SubC = ConstantExpr::getSub(cast<Constant>(BOp0), RHS);
+ return new ICmpInst(ICI.getPredicate(), BOp1, SubC);
} else if (*RHSV == 0) {
// Replace ((sub A, B) != 0) with (A != B)
return new ICmpInst(ICI.getPredicate(), BOp0, BOp1);
OpenPOWER on IntegriCloud