summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-01-18 19:17:58 +0000
committerSanjay Patel <spatel@rotateright.com>2016-01-18 19:17:58 +0000
commitc2ceb8b2d829d8e7a771dd9878f57c464e50d692 (patch)
tree47b06e61f8461b2ed63c574bfdc6524d67f76334 /llvm/lib/Transforms
parent5a3843e5068ab311388f82c73d3cab7cabb99ef5 (diff)
downloadbcm5719-llvm-c2ceb8b2d829d8e7a771dd9878f57c464e50d692.tar.gz
bcm5719-llvm-c2ceb8b2d829d8e7a771dd9878f57c464e50d692.zip
combine clauses with same output ; NFCI
llvm-svn: 258062
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index 400b2f56918..b94f49461f9 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -915,15 +915,10 @@ Value *InstCombiner::FoldAndOfICmps(ICmpInst *LHS, ICmpInst *RHS) {
if (LHSCst == RHSCst && LHSCC == RHSCC) {
// (icmp ult A, C) & (icmp ult B, C) --> (icmp ult (A|B), C)
- // where C is a power of 2
- if (LHSCC == ICmpInst::ICMP_ULT &&
- LHSCst->getValue().isPowerOf2()) {
- Value *NewOr = Builder->CreateOr(Val, Val2);
- return Builder->CreateICmp(LHSCC, NewOr, LHSCst);
- }
-
+ // where C is a power of 2 or
// (icmp eq A, 0) & (icmp eq B, 0) --> (icmp eq (A|B), 0)
- if (LHSCC == ICmpInst::ICMP_EQ && LHSCst->isZero()) {
+ if ((LHSCC == ICmpInst::ICMP_ULT && LHSCst->getValue().isPowerOf2()) ||
+ (LHSCC == ICmpInst::ICMP_EQ && LHSCst->isZero())) {
Value *NewOr = Builder->CreateOr(Val, Val2);
return Builder->CreateICmp(LHSCC, NewOr, LHSCst);
}
OpenPOWER on IntegriCloud