[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp

Evan Cheng evan.cheng at apple.com
Tue May 15 01:42:00 PDT 2007


On May 14, 2007, at 10:57 PM, Chris Lattner wrote:

>> PredicateOperand related bug fix.
>> @@ -2899,7 +2901,7 @@
>>            else if (NodeHasOptInFlag)
>>              EndAdjust = "-(HasInFlag?1:0)"; // May have a flag.
>>
>> -          emitCode("for (unsigned i = " + utostr(NumInputs) +
>> +          emitCode("for (unsigned i = " + utostr(NumInputs -
>> NumEAInputs) +
>>                     ", e = N.getNumOperands()" + EndAdjust + "; i !
>> = e; ++i) {");
>>
>
> Out of curiousity, why is this needed?  Did you hit a bug with
> something when it got selected?

Yes.

>   If the bug was with ISD::Constant's,
> this is a serious bug and this is not the right fix.

Huh? It has nothing to do with ISD::Constants. Remember  
PredicateOperand with ExecuteAlways value is not part of the target  
independent DAG.  So something like this:

def BL : I<(ops i32imm:$func, pred:$p, variable_ops), ...>

The input node should have 2 operands (plus one if it has the  
optional flag) plus the variable ops. The emit code has like this:

   for (unsigned i = 2, e = N.getNumOperands()-(HasInFlag?1:0); i !=  
e; ++i) {
     AddToISelQueue(N.getOperand(i));
     Ops0.push_back(N.getOperand(i));
   }

If we don't discount NumEAInputs (i.e. 1 in this case, to account for  
the single ExecuteAlways value), i's starting value is 3 and that's bad.

Evan

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