[PATCH] D80542: [DAGCombiner] Require ninf for division estimation

Qiu Chaofan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 26 02:39:37 PDT 2020


qiucf created this revision.
qiucf added reviewers: nemanjai, spatel, hfinkel, craig.topper, arsenm, PowerPC.
Herald added subscribers: llvm-commits, ecnelises, kerbowa, hiraditya, nhaehnle, wdng, jvesely.
Herald added a project: LLVM.

This is similar to D76853 <https://reviews.llvm.org/D76853>. Current implementation of division estimation isn't correct for `1.0/0.0` (result is `nan`, not expected `inf`).

And this change exposes a potential infinite loop: in `combineRepeatedFPDivisors`, we use `isConstOrConstSplatFP` to look up if the divisor is some constant. But it doesn't work after legalized on some platforms. This patch restricts the method to act before `LegalDAG`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80542

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/test/CodeGen/AMDGPU/fdiv.ll
  llvm/test/CodeGen/PowerPC/combine-fneg.ll
  llvm/test/CodeGen/PowerPC/fdiv.ll
  llvm/test/CodeGen/PowerPC/qpx-recipest.ll
  llvm/test/CodeGen/PowerPC/recipest.ll
  llvm/test/CodeGen/PowerPC/repeated-fp-divisors.ll
  llvm/test/CodeGen/PowerPC/vsx-recip-est.ll
  llvm/test/CodeGen/X86/fdiv-combine-vec.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80542.266129.patch
Type: text/x-patch
Size: 9622 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200526/539f308c/attachment.bin>


More information about the llvm-commits mailing list