[PATCH] D67721: [InstSimplify] fold fma/fmuladd with a NaN operand

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 14:42:27 PDT 2019


fhahn accepted this revision.
fhahn added a reviewer: mcberg2017.
fhahn added a comment.
This revision is now accepted and ready to land.

In D67721#1686986 <https://reviews.llvm.org/D67721#1686986>, @spatel wrote:

> Patch updated:
>  The other fma-simplification-related patches have landed, but this limited patch is still independent of that.


Right. I think we could also use simplifyFPOp in SimplifyFMAFMul.

Additionally,I think  if the 'add' operand folds to a constant that does not require rounding, we could use SimplifyFMAFMul and try to simplify the whole fma to a constant.

> I did change this patch to use the existing logic that we apply to normal FP ops, so now we fold 'undef' and 'NaN' operands consistently with the FP binops (fmul, fadd, fsub. fdiv, frem).

Great. The naming of simplifyFPOp is a bit unfortunate IMO, but it handles exactly the undef & nan operand cases . LGTM.

Please wait with committing a day or so, in case there are additional comments.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67721/new/

https://reviews.llvm.org/D67721





More information about the llvm-commits mailing list