diff options
author | Chris Lattner <sabre@nondot.org> | 2010-02-01 19:54:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-02-01 19:54:45 +0000 |
commit | 5f670d41318368e2a5fdc6fe2d385f003c6db68d (patch) | |
tree | cfba679dad94e6cf632868005afed24b609d71d2 /lib/Transforms | |
parent | b63127d4359d6a51c35f4ebfabfceac8bbd8364a (diff) | |
download | external_llvm-5f670d41318368e2a5fdc6fe2d385f003c6db68d.zip external_llvm-5f670d41318368e2a5fdc6fe2d385f003c6db68d.tar.gz external_llvm-5f670d41318368e2a5fdc6fe2d385f003c6db68d.tar.bz2 |
cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94995 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineCompares.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp index e59406c..7c00c2c 100644 --- a/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -1589,24 +1589,24 @@ Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) { Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { bool Changed = false; + Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); /// Orders the operands of the compare so that they are listed from most /// complex to least complex. This puts constants before unary operators, /// before binary operators. - if (getComplexity(I.getOperand(0)) < getComplexity(I.getOperand(1))) { + if (getComplexity(Op0) < getComplexity(Op1)) { I.swapOperands(); + std::swap(Op0, Op1); Changed = true; } - Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - if (Value *V = SimplifyICmpInst(I.getPredicate(), Op0, Op1, TD)) return ReplaceInstUsesWith(I, V); const Type *Ty = Op0->getType(); // icmp's with boolean values can always be turned into bitwise operations - if (Ty == Type::getInt1Ty(I.getContext())) { + if (Ty->isInteger(1)) { switch (I.getPredicate()) { default: llvm_unreachable("Invalid icmp instruction!"); case ICmpInst::ICMP_EQ: { // icmp eq i1 A, B -> ~(A^B) |