[llvm-commits] [llvm] r60857 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/add-with-overflow.ll

Bill Wendling isanbard at gmail.com
Wed Dec 10 19:30:01 PST 2008


On Dec 10, 2008, at 6:11 PM, Chris Lattner wrote:

> On Dec 10, 2008, at 2:36 PM, Bill Wendling wrote:
>
>> Author: void
>> Date: Wed Dec 10 16:36:00 2008
>> New Revision: 60857
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=60857&view=rev
>> Log:
>> If ADD, SUB, or MUL have an overflow bit that's used, don't do
>> transformation on
>> them. The DAG combiner expects that nodes that are transformed have
>> one value
>> result.
>
> Bill, I'm very confused about this.  The "ADD" node is defined to have
> two inputs and one output.  How could N->getNumValues() even be non
> 1?  Are you somehow getting SADDO/UADDO into this code?  visitADD
> should only be called on an ADD node.  What am I missing?
>
We converted the ADD node to having an implicit def. The overflow  
checking code then uses that implicit def to generate the overflow/ 
carry check. We did it this way because we needed the generated check  
to be associated with the add in some form. If there wasn't a use of  
that implicit def, then the generated check would be hanging out and  
if a pass comes along and removes or replaces the add instruction,  
then the check would be invalid.

In a sense, the ADDO nodes are acting as an encapsulation of two  
nodes: an ADD plus an associated SETCC. Should they be more first- 
class citizens of the back-end?

-bw



More information about the llvm-commits mailing list