summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2010-09-12 06:09:23 +0000
committerEric Christopher <echristo@apple.com>2010-09-12 06:09:23 +0000
commit26abd3e0c21331f610558a2cf3a385c4d1fc9596 (patch)
tree9bd4a95f60168c34452ef2bf0d52ef727e94958e /llvm/lib/Transforms
parent0c38b0deb85e1d495eb1b99be2e205ba167b147b (diff)
downloadbcm5719-llvm-26abd3e0c21331f610558a2cf3a385c4d1fc9596.tar.gz
bcm5719-llvm-26abd3e0c21331f610558a2cf3a385c4d1fc9596.zip
Revert 113679, it was causing an infinite loop in a testcase that I've sent
on to Owen. llvm-svn: 113720
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp35
1 files changed, 5 insertions, 30 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index d30655f9859..3dc8779879d 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -207,26 +207,12 @@ Instruction *InstCombiner::OptAndOp(Instruction *Op,
}
break;
case Instruction::Or:
- if (Op->hasOneUse()){
- if (Together != OpRHS) {
- // (X | C1) & C2 --> (X | (C1&C2)) & C2
- Value *Or = Builder->CreateOr(X, Together);
- Or->takeName(Op);
- return BinaryOperator::CreateAnd(Or, AndRHS);
- }
-
- ConstantInt *TogetherCI = dyn_cast<ConstantInt>(Together);
- if (TogetherCI && !TogetherCI->isZero()){
- // (X | C1) & C2 --> (X & (C2^(C1&C2))) | C1
- // NOTE: This reduces the number of bits set in the & mask, which
- // can expose opportunities for store narrowing.
- Together = ConstantExpr::getXor(AndRHS, Together);
- Value *And = Builder->CreateAnd(X, Together);
- And->takeName(Op);
- return BinaryOperator::CreateOr(And, OpRHS);
- }
+ if (Op->hasOneUse() && Together != OpRHS) {
+ // (X | C1) & C2 --> (X | (C1&C2)) & C2
+ Value *Or = Builder->CreateOr(X, Together);
+ Or->takeName(Op);
+ return BinaryOperator::CreateAnd(Or, AndRHS);
}
-
break;
case Instruction::Add:
if (Op->hasOneUse()) {
@@ -1957,17 +1943,6 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
}
}
- // Note: If we've gotten to the point of visiting the outer OR, then the
- // inner one couldn't be simplified. If it was a constant, then it won't
- // be simplified by a later pass either, so we try swapping the inner/outer
- // ORs in the hopes that we'll be able to simplify it this way.
- // (X|C) | V --> (X|V) | C
- if (Op0->hasOneUse() && match(Op0, m_Or(m_Value(A), m_ConstantInt(C1)))) {
- Value *Inner = Builder->CreateOr(Op0, Op1);
- Inner->takeName(Op0);
- return BinaryOperator::CreateOr(Inner, C1);
- }
-
return Changed ? &I : 0;
}
OpenPOWER on IntegriCloud