[llvm-commits] [llvm] r75531 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/zext-bool-add-sub.ll
Chris Lattner
clattner at apple.com
Mon Jul 13 15:35:35 PDT 2009
On Jul 13, 2009, at 3:27 PM, Eli Friedman wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=75531&view=rev
> Log:
> Canonicalize boolean +/- a constant to a select.
>
> (I think it's reasonably clear that we want to have a canonical form
> for
> constructs like this; if anyone thinks that a select is not the best
> canonical form, please tell me.)
I think "select c, -1, 0" -> "sext c" and "select c, 0, -1" -> "sext !
c" would make sense, what do you think?
> + // C - zext(bool) -> bool ? C - 1 : C
> + if (ZExtInst *ZI = dyn_cast<ZExtInst>(Op1))
> + if (ZI->getSrcTy() == Type::Int1Ty)
> + return SelectInst::Create(ZI->getOperand(0), SubOne(C,
> Context), C);
This one seems reasonable though,
-Chris
More information about the llvm-commits
mailing list