[all-commits] [llvm/llvm-project] c3d05c: [SelectionDAG] Expand nnan FMINNUM/FMAXNUM to sele...

Ulrich Weigand via All-commits all-commits at lists.llvm.org
Wed Dec 4 01:33:08 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c3d05c1b5209122dbb18e2d7126c14359b6dfa90
      https://github.com/llvm/llvm-project/commit/c3d05c1b5209122dbb18e2d7126c14359b6dfa90
  Author: Ulrich Weigand <ulrich.weigand at de.ibm.com>
  Date:   2019-12-04 (Wed, 04 Dec 2019)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    M llvm/test/CodeGen/SystemZ/fp-libcall.ll

  Log Message:
  -----------
  [SelectionDAG] Expand nnan FMINNUM/FMAXNUM to select sequence

InstCombine may synthesize FMINNUM/FMAXNUM nodes from fcmp+select
sequences (where the fcmp is marked nnan).  Currently, if the
target does not otherwise handle these nodes, they'll get expanded
to libcalls to fmin/fmax.  However, these functions may reside in
libm, which may introduce a library dependency that was not originally
present in the source code, potentially resulting in link failures.

To fix this problem, add code to TargetLowering::expandFMINNUM_FMAXNUM
to expand FMINNUM/FMAXNUM to a compare+select sequence instead of the
libcall. This is done only if the node is marked as "nnan"; in this case,
the expansion to compare+select is always correct. This also suffices to
catch all cases where FMINNUM/FMAXNUM was synthesized as above.

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




More information about the All-commits mailing list