[PATCH] DAGCombiner: Continue combining if FoldConstantArithmetic() fails.

Ahmed Bougacha ahmed.bougacha at gmail.com
Tue Jan 13 12:07:03 PST 2015



> On Jan 13, 2015, at 6:14 PM, Matthias Braun <matze at braunis.de> wrote:
> 
> 
>> On Jan 12, 2015, at 8:02 PM, Ahmed Bougacha <ahmed.bougacha at gmail.com> wrote:
>> 
>> ================
>> Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1572
>> @@ +1571,3 @@
>> +  if (N0C && N1C) {
>> +    SDValue Folded = DAG.FoldConstantArithmetic(ISD::ADD, VT, N0C, N1C);
>> +    if (Folded.getNode())
>> ----------------
>> How about:
>> 
>>   if (SDValue Folded = ...)
>>     return Folded;
>> 
>> Or going further, you could remove the N0C && N1C check, since FoldConstantArithmetic also does it (a sliver more wasteful though).
> 
> unfortunately
> if ((SDValue Folded = ...).getNode())
>    return Folded;
> would be necessary and is not valid C++.

I meant without ".getNode()": IIRC, SDValue has the necessary operator (bool).

-Ahmed

> 
> _______________________________________________
> 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