diff options
author | Reid Kleckner <rnk@google.com> | 2018-03-21 20:35:36 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-03-21 20:35:36 +0000 |
commit | 762331be070b670805582d853e66eb07cada13d3 (patch) | |
tree | 3ac028d66d9177238617bb860a78193c3529bb73 /llvm/lib | |
parent | c8d395a168f141ceaec5705899a9aa5d13422085 (diff) | |
download | bcm5719-llvm-762331be070b670805582d853e66eb07cada13d3.tar.gz bcm5719-llvm-762331be070b670805582d853e66eb07cada13d3.zip |
Revert r328119 "[InstCombine] add folds for xor-of-icmp signbit tests (PR36682)"
This asserts when compiling safe_numerics_unittest.cpp in Chromium with
MSan.
llvm-svn: 328145
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index 7c720d80092..4a5a6d1ccbc 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -2363,36 +2363,6 @@ Value *InstCombiner::foldXorOfICmps(ICmpInst *LHS, ICmpInst *RHS) { } } - // TODO: This can be generalized to compares of non-signbits using - // decomposeBitTestICmp(). It could be enhanced more by using (something like) - // foldLogOpOfMaskedICmps(). - ICmpInst::Predicate PredL = LHS->getPredicate(); - ICmpInst::Predicate PredR = RHS->getPredicate(); - Value *LHS0 = LHS->getOperand(0), *LHS1 = LHS->getOperand(1); - Value *RHS0 = RHS->getOperand(0), *RHS1 = RHS->getOperand(1); - if ((LHS->hasOneUse() || RHS->hasOneUse()) && PredL == PredR) { - // (X > -1) ^ (Y > -1) --> (X ^ Y) < 0 - // (X < 0) ^ (Y < 0) --> (X ^ Y) < 0 - if ((match(LHS1, m_AllOnes()) && match(RHS1, m_AllOnes()) && - PredL == CmpInst::ICMP_SGT) || - (match(LHS1, m_Zero()) && match(RHS1, m_Zero()) && - PredL == CmpInst::ICMP_SLT)) { - Value *Zero = ConstantInt::getNullValue(LHS0->getType()); - return Builder.CreateICmpSLT(Builder.CreateXor(LHS0, RHS0), Zero); - } - } - if ((LHS->hasOneUse() || RHS->hasOneUse())) { - // (X > -1) ^ (Y < 0) --> (X ^ Y) > -1 - // (X < 0) ^ (Y > -1) --> (X ^ Y) > -1 - if ((match(LHS1, m_AllOnes()) && match(RHS1, m_Zero()) && - PredL == CmpInst::ICMP_SGT && PredR == CmpInst::ICMP_SLT) || - (match(LHS1, m_Zero()) && match(RHS1, m_AllOnes()) && - PredL == CmpInst::ICMP_SLT && PredR == CmpInst::ICMP_SGT)) { - Value *MinusOne = ConstantInt::getAllOnesValue(LHS0->getType()); - return Builder.CreateICmpSGT(Builder.CreateXor(LHS0, RHS0), MinusOne); - } - } - // Instead of trying to imitate the folds for and/or, decompose this 'xor' // into those logic ops. That is, try to turn this into an and-of-icmps // because we have many folds for that pattern. |