[llvm-commits] [llvm] r60397 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
clattner at apple.com
Mon Dec 1 21:58:01 PST 2008
On Dec 1, 2008, at 9:06 PM, Bill Wendling wrote:
> Author: void
> Date: Mon Dec 1 23:06:43 2008
> New Revision: 60397
>
> URL: http://llvm.org/viewvc/llvm-project?rev=60397&view=rev
> Log:
> - Reduce nesting.
> - No need to do a swap on a canonicalized pattern.
>
> No functionality change.
Thanks Bill, getting better.
> + ConstantInt *CI1 = dyn_cast<ConstantInt>(C);
> + if (!CI1) return 0;
> +
> + Value *V1 = 0, *C2 = 0;
> + if (match(Op, m_And(m_Value(V1), m_Value(C2)))) {
if (!match) return 0;
>
> + ConstantInt *CI2 = dyn_cast<ConstantInt>(C2);
> + if (!CI2) return 0;
Please pull the matching of C2 -> constantint into the "match".
>
> +
> + APInt Xor = CI1->getValue() ^ CI2->getValue();
> + if (Xor.isAllOnesValue()) {
if (!Xor.isAllOnesValue()) return 0;
>
> + if (V1 == B) {
> + Instruction *NewOp =
> + InsertNewInstBefore(BinaryOperator::CreateAnd(A, CI1), I);
> + return BinaryOperator::CreateOr(NewOp, B);
> + } else if (V1 == A) {
> + Instruction *NewOp =
> + InsertNewInstBefore(BinaryOperator::CreateAnd(B, CI1), I);
> + return BinaryOperator::CreateOr(NewOp, A);
> }
Please merge these.
-Chris
>
> }
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list