summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-16 05:14:43 +0000
committerChris Lattner <sabre@nondot.org>2008-11-16 05:14:43 +0000
commit909b969b18328c9982a02b225d5e4321916d1ae7 (patch)
tree234eb6661713e27348bce99414a694f7b54eee3e /llvm/lib
parentfeaea9bdf752de83af48295b14acec13c41e25f3 (diff)
downloadbcm5719-llvm-909b969b18328c9982a02b225d5e4321916d1ae7.tar.gz
bcm5719-llvm-909b969b18328c9982a02b225d5e4321916d1ae7.zip
do some computation with apints instead of ConstantInts.
llvm-svn: 59401
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index a8dcfa447da..acea4bd49a5 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -3590,16 +3590,15 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I,
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);
OpenPOWER on IntegriCloud