On Jul 3, 2007, at 7:43 AM, Duncan Sands wrote:
> Hi Dan,
>> +  // fold (add x, undef) -> undef
>> +  if (N1.getOpcode() == ISD::UNDEF)
>> +    return N1;
>
> what if N0 is undef and not N1?

Presumably, undef is being canonicalized to the RHS somewhere. I  
don't know if this is actually true in the dag combiner though, it  
should be checked.

>> +  // fold (mul x, undef) -> 0
>> +  if (N1.getOpcode() == ISD::UNDEF)
>> +    return DAG.getConstant(0, VT);
>
> Yes, this seems better :)  Again, is the undef guaranteed to be
> in N1 and not N0?

Does this work for vectors?  Does DAG.getConstant(0, MVT::v4i32)  
work?  This xform should probably be disabled after legalize for  
vectors.

>> +  // fold (or x, undef) -> -1
>> +  if (N1.getOpcode() == ISD::UNDEF)
>> +    return DAG.getConstant(-1, VT);
>
> Is this the right way to get an all-bits-one value?

Yes, but this has the same problem with vectors. :)

-Chris


_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to