diff options
author | Sanjay Patel <spatel@rotateright.com> | 2016-09-15 17:01:17 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2016-09-15 17:01:17 +0000 |
commit | 362ff5c0a531987f98074b49ef3eb7387c3f1186 (patch) | |
tree | f00433777a2ae01577eea2687b6874736b73cb32 /llvm/lib | |
parent | b2d62bd071c6e005483c9fa5b917d7261295eb0c (diff) | |
download | bcm5719-llvm-362ff5c0a531987f98074b49ef3eb7387c3f1186.tar.gz bcm5719-llvm-362ff5c0a531987f98074b49ef3eb7387c3f1186.zip |
[InstCombine] remove duplicated fold ; NFCI
This pattern is matched in foldICmpBinOpEqualityWithConstant() and already works
with vectors too. I changed some comments over there to point out the current
location. The tests for this transform are currently in 'sub.ll'.
Note that the remaining folds in this block all require a sub too, so they should
get grouped with the other icmp(sub) patterns.
llvm-svn: 281627
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index e8c6a27090d..f14b818c594 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -1423,11 +1423,6 @@ Instruction *InstCombiner::foldICmpWithConstant(ICmpInst &Cmp) { // The following transforms are only worth it if the only user of the subtract // is the icmp. if (X->hasOneUse()) { - // (icmp ne/eq (sub A B) 0) -> (icmp ne/eq A, B) - if (Cmp.isEquality() && CI->isZero() && - match(X, m_Sub(m_Value(A), m_Value(B)))) - return new ICmpInst(Pred, A, B); - // (icmp sgt (sub nsw A B), -1) -> (icmp sge A, B) if (Pred == ICmpInst::ICMP_SGT && CI->isAllOnesValue() && match(X, m_NSWSub(m_Value(A), m_Value(B)))) @@ -2522,11 +2517,11 @@ Instruction *InstCombiner::foldICmpBinOpEqualityWithConstant(ICmpInst &Cmp, if (BO->hasOneUse()) { const APInt *BOC; if (match(BOp0, m_APInt(BOC))) { - // Replace ((sub A, B) != C) with (B != A-C) if A & C are constants. + // Replace ((sub BOC, B) != C) with (B != BOC-C). Constant *SubC = ConstantExpr::getSub(cast<Constant>(BOp0), RHS); return new ICmpInst(Pred, BOp1, SubC); } else if (*C == 0) { - // Replace ((sub A, B) != 0) with (A != B) + // Replace ((sub A, B) != 0) with (A != B). return new ICmpInst(Pred, BOp0, BOp1); } } |