diff options
author | Sanjay Patel <spatel@rotateright.com> | 2016-08-03 19:48:40 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2016-08-03 19:48:40 +0000 |
commit | 2e9675ff5247da937b1594f06fd5b8bbab7c5bf1 (patch) | |
tree | 71480caacb30c28c1e984425c0e752bfdf0f8010 /llvm/lib/Transforms | |
parent | 82e355ce481e78441c22b5b1a05fef734b8d131e (diff) | |
download | bcm5719-llvm-2e9675ff5247da937b1594f06fd5b8bbab7c5bf1.tar.gz bcm5719-llvm-2e9675ff5247da937b1594f06fd5b8bbab7c5bf1.zip |
[InstCombine] use m_APInt to allow icmp eq (srem X, C1), C2 folds for splat constant vectors
llvm-svn: 277638
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 4b949ab6561..576aa2d28ac 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -2218,10 +2218,9 @@ Instruction *InstCombiner::foldICmpEqualityWithConstant(ICmpInst &ICI) { switch (BO->getOpcode()) { case Instruction::SRem: // If we have a signed (X % (2^c)) == 0, turn it into an unsigned one. - // FIXME: Vectors are excluded by ConstantInt. - if (*RHSV == 0 && isa<ConstantInt>(BOp1) && BO->hasOneUse()) { - const APInt &V = cast<ConstantInt>(BOp1)->getValue(); - if (V.sgt(1) && V.isPowerOf2()) { + if (*RHSV == 0 && BO->hasOneUse()) { + const APInt *BOC; + if (match(BOp1, m_APInt(BOC)) && BOC->sgt(1) && BOC->isPowerOf2()) { Value *NewRem = Builder->CreateURem(BOp0, BOp1, BO->getName()); return new ICmpInst(ICI.getPredicate(), NewRem, Constant::getNullValue(BO->getType())); |