[llvm-commits] [llvm] r54877 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Nick Lewycky
nicholas at mxc.ca
Sun Aug 17 00:54:15 PDT 2008
Author: nicholas
Date: Sun Aug 17 02:54:14 2008
New Revision: 54877
URL: http://llvm.org/viewvc/llvm-project?rev=54877&view=rev
Log:
I found a better place for this optz'n.
Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=54877&r1=54876&r2=54877&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sun Aug 17 02:54:14 2008
@@ -5241,20 +5241,6 @@
return new ICmpInst(I.getPredicate(), A, B);
}
- ConstantInt *CI2;
- // (icmp u/s (xor A SignBit), C) -> (icmp s/u A, (xor C SignBit))
- if (!I.isEquality() &&
- match(Op0, m_Xor(m_Value(A), m_ConstantInt(CI2)))) {
- if (CI2->getValue().isSignBit()) {
- const APInt &SignBit = CI2->getValue();
- ICmpInst::Predicate Pred = I.isSignedPredicate()
- ? I.getUnsignedPredicate()
- : I.getSignedPredicate();
- return new ICmpInst(Pred, A,
- ConstantInt::get(CI->getValue() ^ SignBit));
- }
- }
-
// If we have a icmp le or icmp ge instruction, turn it into the appropriate
// icmp lt or icmp gt instruction. This allows us to rely on them being
// folded in the code below.
@@ -5822,6 +5808,16 @@
else
return new ICmpInst(ICmpInst::ICMP_SLT, CompareVal, AddOne(RHS));
}
+
+ // (icmp u/s (xor A SignBit), C) -> (icmp s/u A, (xor C SignBit))
+ if (!ICI.isEquality() && XorCST->getValue().isSignBit()) {
+ const APInt &SignBit = XorCST->getValue();
+ ICmpInst::Predicate Pred = ICI.isSignedPredicate()
+ ? ICI.getUnsignedPredicate()
+ : ICI.getSignedPredicate();
+ return new ICmpInst(Pred, LHSI->getOperand(0),
+ ConstantInt::get(RHSV ^ SignBit));
+ }
}
break;
case Instruction::And: // (icmp pred (and X, AndCST), RHS)
More information about the llvm-commits
mailing list