[llvm-commits] [llvm] r37851 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Chris Lattner
clattner at apple.com
Tue Jul 3 14:42:01 PDT 2007
>>> + // 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?
>
> I guess DAG.getConstant(~0ULL, VT) is the way its written
> elsewhere. And I
> have to fix it for vectors. I'll work on it.
Either way works. "-1" is a signed integer that sign extends to
uint64_t. ~0ULL is more explicit though.
> Looking at it a little more, I think the instcombine folds are
> actually
> wrong here. For example, it does X + undef -> undef, but that's
> wrong if
> X is a NaN.
Ah, good point.
-Chris
More information about the llvm-commits
mailing list