[llvm-commits] [llvm] r59401 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
sabre at nondot.org
Sat Nov 15 21:14:44 PST 2008
Author: lattner
Date: Sat Nov 15 23:14:43 2008
New Revision: 59401
URL: http://llvm.org/viewvc/llvm-project?rev=59401&view=rev
Log:
do some computation with apints instead of ConstantInts.
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=59401&r1=59400&r2=59401&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sat Nov 15 23:14:43 2008
@@ -3590,16 +3590,15 @@
return 0;
// Ensure that the larger constant is on the RHS.
- ICmpInst::Predicate GT;
+ bool ShouldSwap;
if (ICmpInst::isSignedPredicate(LHSCC) ||
(ICmpInst::isEquality(LHSCC) &&
ICmpInst::isSignedPredicate(RHSCC)))
- GT = ICmpInst::ICMP_SGT;
+ ShouldSwap = LHSCst->getValue().sgt(RHSCst->getValue());
else
- GT = ICmpInst::ICMP_UGT;
-
- Constant *Cmp = ConstantExpr::getICmp(GT, LHSCst, RHSCst);
- if (cast<ConstantInt>(Cmp)->getZExtValue()) {
+ ShouldSwap = LHSCst->getValue().ugt(RHSCst->getValue());
+
+ if (ShouldSwap) {
std::swap(LHS, RHS);
std::swap(LHSCst, RHSCst);
std::swap(LHSCC, RHSCC);
More information about the llvm-commits
mailing list