diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-16 05:14:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-16 05:14:43 +0000 |
commit | aa3e15784573a560b89478d72dcb108096a82df5 (patch) | |
tree | 87566d37907edd22feca86ba4a7602e848ca6ec9 /lib/Transforms | |
parent | ea065fbdd8cb7593ee4b45e4aa0c33ff46c669ad (diff) | |
download | external_llvm-aa3e15784573a560b89478d72dcb108096a82df5.zip external_llvm-aa3e15784573a560b89478d72dcb108096a82df5.tar.gz external_llvm-aa3e15784573a560b89478d72dcb108096a82df5.tar.bz2 |
do some computation with apints instead of ConstantInts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59401 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index a8dcfa4..acea4bd 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/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); |