summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-02 07:15:30 +0000
committerChris Lattner <sabre@nondot.org>2009-02-02 07:15:30 +0000
commit1aafe4ceceeeb8ff57fc43f40f93ab3591a98e70 (patch)
treea4796c10c7d9da9fe25c39032f424f645e5f58a9 /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parentc4eb63d412af104e790fb0d16755eb5e61ab1096 (diff)
downloadbcm5719-llvm-1aafe4ceceeeb8ff57fc43f40f93ab3591a98e70.tar.gz
bcm5719-llvm-1aafe4ceceeeb8ff57fc43f40f93ab3591a98e70.zip
reduce indentation, (~XorCST->getValue()).isSignBit() -> isMaxSignedValue()
llvm-svn: 63500
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index a1cb3dc39fc..77a7d93d410 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -6101,27 +6101,26 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
case Instruction::Add:
case Instruction::Sub:
case Instruction::Xor:
- if (I.isEquality()) {
- // a+x icmp eq/ne b+x --> a icmp b
+ if (I.isEquality()) // a+x icmp eq/ne b+x --> a icmp b
return new ICmpInst(I.getPredicate(), Op0I->getOperand(0),
Op1I->getOperand(0));
- } else {
- // icmp u/s (a ^ signbit), (b ^ signbit) --> icmp s/u a, b
- if (ConstantInt *CI = dyn_cast<ConstantInt>(Op0I->getOperand(1))) {
- if (CI->getValue().isSignBit()) {
- ICmpInst::Predicate Pred = I.isSignedPredicate()
- ? I.getUnsignedPredicate()
- : I.getSignedPredicate();
- return new ICmpInst(Pred, Op0I->getOperand(0),
- Op1I->getOperand(0));
- } else if ((~CI->getValue()).isSignBit()) {
- ICmpInst::Predicate Pred = I.isSignedPredicate()
- ? I.getUnsignedPredicate()
- : I.getSignedPredicate();
- Pred = I.getSwappedPredicate(Pred);
- return new ICmpInst(Pred, Op0I->getOperand(0),
- Op1I->getOperand(0));
- }
+ // icmp u/s (a ^ signbit), (b ^ signbit) --> icmp s/u a, b
+ if (ConstantInt *CI = dyn_cast<ConstantInt>(Op0I->getOperand(1))) {
+ if (CI->getValue().isSignBit()) {
+ ICmpInst::Predicate Pred = I.isSignedPredicate()
+ ? I.getUnsignedPredicate()
+ : I.getSignedPredicate();
+ return new ICmpInst(Pred, Op0I->getOperand(0),
+ Op1I->getOperand(0));
+ }
+
+ if (CI->getValue().isMaxSignedValue()) {
+ ICmpInst::Predicate Pred = I.isSignedPredicate()
+ ? I.getUnsignedPredicate()
+ : I.getSignedPredicate();
+ Pred = I.getSwappedPredicate(Pred);
+ return new ICmpInst(Pred, Op0I->getOperand(0),
+ Op1I->getOperand(0));
}
}
break;
@@ -6460,7 +6459,7 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI,
}
// (icmp u/s (xor A ~SignBit), C) -> (icmp s/u (xor C ~SignBit), A)
- if (!ICI.isEquality() && (~XorCST->getValue()).isSignBit()) {
+ if (!ICI.isEquality() && XorCST->getValue().isMaxSignedValue()) {
const APInt &NotSignBit = XorCST->getValue();
ICmpInst::Predicate Pred = ICI.isSignedPredicate()
? ICI.getUnsignedPredicate()
OpenPOWER on IntegriCloud