From: Chris Lattner Date: Mon, 1 Feb 2010 19:54:45 +0000 (+0000) Subject: cleanups. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=5f670d41318368e2a5fdc6fe2d385f003c6db68d;p=oota-llvm.git cleanups. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94995 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp index e59406c636a..7c00c2c61c0 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)