[llvm-commits] [llvm] r92419 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/or.ll

Chris Lattner clattner at apple.com
Sat Jan 2 11:49:47 PST 2010


On Jan 2, 2010, at 8:14 AM, Nick Lewycky wrote:
Author: nicholas
> Date: Sat Jan  2 10:14:56 2010
> New Revision: 92419
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=92419&view=rev
> Log:
> Fix logic error in previous commit. The != case needs to become an or, not an
> and.

Looks good, one minor thing:

> +      Instruction *Op;
> +      if (ICI.getPredicate() == ICmpInst::ICMP_EQ)
> +        Op = BinaryOperator::CreateAnd(ICIP, ICIQ, "");
> +      else
> +        Op = BinaryOperator::CreateOr(ICIP, ICIQ, "");
> +      Op->takeName(&ICI);
> +      return Op;

The preferred idiom is to just return the new instruction with no name (and you don't need to pass ""), the caller fills in the name from the instruction it is replacing.

-Chris





More information about the llvm-commits mailing list