[llvm-commits] [llvm] r61401 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/2008-12-23-dagcombine-6.ll

Chris Lattner clattner at apple.com
Tue Dec 23 15:14:41 PST 2008


>
> URL: http://llvm.org/viewvc/llvm-project?rev=61401&view=rev
> Log:
> Add another permutation where we should get rid of a-a.

> @@ -1177,13 +1177,20 @@
>     return N0.getOperand(1);
>   // fold (A+B)-B -> A
>   if (N0.getOpcode() == ISD::ADD && N0.getOperand(1) == N1)
> -    return N0.getOperand(0);
> -  // fold ((A+(B-C))-B) -> A-C
> +    return N0.getOperand(0);
> +  // fold ((A+(B+-C))-B) -> A+-C

I don't see why you'd ever way to match on A + (-B).  Shouldn't dag  
combine independently fold this into A-B?

-Chris




More information about the llvm-commits mailing list