[all-commits] [llvm/llvm-project] c8d91b: Reassoc FMF should not optimize FMA(a, 0, b) to (b)

Sven van Haastregt via All-commits all-commits at lists.llvm.org
Tue Jul 26 01:39:52 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c8d91b07bba80ac204a93b61c3dd2b0c79aa2402
  Author: Sven van Haastregt <sven.vanhaastregt at arm.com>
  Date:   2022-07-26 (Tue, 26 Jul 2022)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/AArch64/neon-fma-FMF.ll

  Log Message:
  Reassoc FMF should not optimize FMA(a, 0, b) to (b)

Optimizing (a * 0 + b) to (b) requires assuming that a is finite and not
NaN. DAGCombiner will do this optimization when the reassoc fast math
flag is set, which is not correct. Change DAGCombiner to only consider
UnsafeMath for this optimization.

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

Co-authored-by: Andrea Faulds <andrea.faulds at arm.com>

More information about the All-commits mailing list