[all-commits] [llvm/llvm-project] 39009a: [DAGCombiner] tighten fast-math constraints for fm...

RotateRight via All-commits all-commits at lists.llvm.org
Sun Jul 12 05:53:22 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 39009a8245dae78250081b16fc679ce338af405a
      https://github.com/llvm/llvm-project/commit/39009a8245dae78250081b16fc679ce338af405a
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2020-07-12 (Sun, 12 Jul 2020)

  Changed paths:
    M llvm/docs/LangRef.rst
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/AArch64/fadd-combines.ll
    M llvm/test/CodeGen/X86/fma_patterns.ll

  Log Message:
  -----------
  [DAGCombiner] tighten fast-math constraints for fma fold

fadd (fma A, B, (fmul C, D)), E --> fma A, B, (fma C, D, E)

This is only allowed when "reassoc" is present on the fadd.

As discussed in D80801, this transform goes beyond
what is allowed by "contract" FMF (-ffp-contract=fast).
That is because we are fusing the trailing add of 'E' with a
multiply, but without "reassoc", the code mandates that the
products A*B and C*D are added together before adding in 'E'.

I've added this example to the LangRef to try to clarify the
meaning of "contract". If that seems reasonable, we should
probably do something similar for the clang docs because
there does not appear to be any formal spec for the behavior
of -ffp-contract=fast.

Differential Revision: https://reviews.llvm.org/D82499




More information about the All-commits mailing list