[llvm-commits] [llvm] r46922 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Bill Wendling isanbard at gmail.com
Sun Feb 10 23:09:01 PST 2008


On Feb 10, 2008, at 7:46 PM, Evan Cheng wrote:

> What is this fixing?

The code as it was was a no-op. This makes it do what the comment  
says it's supposed to do.

> I would expect SelectionDAG to constant
> evaluating it to a constant node?
>
Perhaps. But then why is it here at all then?

-bw

> On Feb 10, 2008, at 12:10 AM, Bill Wendling wrote:
>
>> Author: void
>> Date: Sun Feb 10 02:10:24 2008
>> New Revision: 46922
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=46922&view=rev
>> Log:
>> Return "(c1 + c2)" instead of yet another ADD node (which made this a
>> no-op).
>>
>> ===================================================================== 
>> =
>> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sun Feb 10
>> 02:10:24 2008
>> @@ -923,7 +923,7 @@
>>     return N1;
>>   // fold (add c1, c2) -> c1+c2
>>   if (N0C && N1C)
>> -    return DAG.getNode(ISD::ADD, VT, N0, N1);
>> +    return DAG.getConstant(N0C->getValue() + N1C->getValue(), VT);
>>   // canonicalize constant to RHS
>>   if (N0C && !N1C)
>>     return DAG.getNode(ISD::ADD, VT, N1, N0);
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> 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