[PATCH] D75576: [SDAG] simplify FP binops to undef

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 15:00:45 PST 2020


spatel created this revision.
spatel added reviewers: lebedev.ri, aqjune, nlopes, cameron.mcinally.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.
spatel edited the summary of this revision.

As discussed in the commit thread for rGa253a2a <https://reviews.llvm.org/rGa253a2a793cda34d1f6421ee9b7ca76a03fdfc59> and D73978 <https://reviews.llvm.org/D73978>, we can do more undef folding for FP ops. The nnan and ninf fast-math-flags specify that if an operand is the disallowed value, the result is poison, so we can produce an undef result.

But this doesn't work as expected (the undef operand cases remain) because of a Flags propagation problem in SelectionDAGBuilder.

I've added DAGCombiner calls to enable these for the other cases because we've shown in other patches that (because of the limited way that SDAG iterates), it is possible to miss simplifications like this if they are done only at node creation time.


https://reviews.llvm.org/D75576

Files:
  llvm/include/llvm/CodeGen/SelectionDAG.h
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/test/CodeGen/AArch64/fp-const-fold.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75576.248046.patch
Type: text/x-patch
Size: 7359 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200303/669cbe3f/attachment.bin>


More information about the llvm-commits mailing list