[llvm-dev] Why does FPBinOp(X, undef) -> NaN? (original) (raw)
Cameron McInally via llvm-dev llvm-dev at lists.llvm.org
Fri Feb 7 09:20:51 PST 2020
- Previous message: [llvm-dev] Removing a redundant unconditional branch
- Next message: [llvm-dev] Why does FPBinOp(X, undef) -> NaN?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I came across this comment in SelectionDAG.cpp:
case ISD::FADD: case ISD::FSUB: case ISD::FMUL: case ISD::FDIV: case ISD::FREM: // If both operands are undef, the result is undef. If 1 operand is undef, // the result is NaN. This should match the behavior of the IR optimizer.
That isn't intuitive to me. I would have expected a binary FP operation with one undef operand to fold to undef. Does anyone know the reasoning behind that decision? I don't see the value added in returning a NaN here.
Thx, Cameron
- Previous message: [llvm-dev] Removing a redundant unconditional branch
- Next message: [llvm-dev] Why does FPBinOp(X, undef) -> NaN?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]