[llvm-commits] [llvm] r75531 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/zext-bool-add-sub.ll
clattner at apple.com
Mon Jul 13 17:35:35 CDT 2009
On Jul 13, 2009, at 3:27 PM, Eli Friedman wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=75531&view=rev
> Canonicalize boolean +/- a constant to a select.
> (I think it's reasonably clear that we want to have a canonical form
> 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,
More information about the llvm-commits