[PATCH] D72341: [FPEnv][WIP] Fix chain handling for fpexcept.strict nodes

Ulrich Weigand via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 08:58:59 PST 2020


uweigand created this revision.
uweigand added reviewers: craig.topper, cameron.mcinally, andrew.w.kaylor, kpn, arsenm.
Herald added subscribers: llvm-commits, jsji, kbarton, hiraditya, wdng, nemanjai.
Herald added a project: LLVM.

As pointed out in D70913 <https://reviews.llvm.org/D70913>, it turns out we need to ensure that fpexcept.strict nodes are not optimized away even if the result is unused.  To do that, we need to chain them into the block's terminator nodes, like already done for PendingExcepts.

This patch adds two new lists of pending chains, PendingConstrainedFP and PendingConstrainedFPStrict to hold constrained FP intrinsic nodes without and with fpexcept.strict markers.  This allows not only to solve the above problem, but also to relax chains a bit further by no longer flushing all FP nodes before a store or other memory access.  (They are still flushed before nodes with other side effects.)

Note that this patch currently introduces test case failures:

  LLVM :: CodeGen/X86/vec-strict-cmp-128.ll
  LLVM :: CodeGen/X86/vec-strict-cmp-256.ll
  LLVM :: CodeGen/X86/vec-strict-cmp-512.ll
  LLVM :: CodeGen/X86/vec-strict-fptoint-128.ll
  LLVM :: CodeGen/X86/vec-strict-fptoint-256.ll
  LLVM :: CodeGen/X86/vec-strict-fptoint-512.ll

These appear to be caused by problems handling the outgoing chains of some strictfp nodes in the X86 back-end; these problems were unnoticed before this patch because the outgoing chains were simply unused with those simple tests otherwise.

It may be that this is actually the same problem to be addressed by D72224 <https://reviews.llvm.org/D72224>;  @craig.topper , maybe you can have a look?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72341

Files:
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
  llvm/test/CodeGen/PowerPC/ppcf128-constrained-fp-intrinsics.ll
  llvm/test/CodeGen/SystemZ/fp-strict-alias.ll
  llvm/test/CodeGen/SystemZ/vector-constrained-fp-intrinsics.ll
  llvm/test/CodeGen/X86/fp-intrinsics.ll
  llvm/test/CodeGen/X86/fp128-cast-strict.ll
  llvm/test/CodeGen/X86/fp128-libcalls-strict.ll
  llvm/test/CodeGen/X86/vec-strict-inttofp-256.ll
  llvm/test/CodeGen/X86/vector-constrained-fp-intrinsics-flags.ll
  llvm/test/CodeGen/X86/vector-constrained-fp-intrinsics.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72341.236606.patch
Type: text/x-patch
Size: 98756 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200107/a3894138/attachment-0001.bin>


More information about the llvm-commits mailing list