[llvm-dev] Why does FPBinOp(X, undef) -> NaN?
Cameron McInally via llvm-dev
llvm-dev at lists.llvm.org
Fri Feb 7 11:12:06 PST 2020
On Fri, Feb 7, 2020 at 1:48 PM Roman Lebedev <lebedev.ri at gmail.com> wrote:
> > case ISD::ADD:
> > case ISD::SUB:
>
> > case ISD::UDIV:
> > case ISD::SDIV:
> > case ISD::UREM:
> > case ISD::SREM:
> > return getUNDEF(VT); // fold op(arg1, undef) -> undef
> For these 4 - because divisor 'undef' can be defined to any value, including 0,
> but divisor can't be 0..
That makes sense. It's undefined behavior, so the "some value" as
output is fine.
The ADD and SUB I don't understand. Perhaps it's because there's no
single value for undef that will always give one defined result? Is
that a requirement?
More information about the llvm-dev
mailing list