[all-commits] [llvm/llvm-project] 9e49d1: [InstCombine] fma x, y, 0 -> fmul x, y

David Green via All-commits all-commits at lists.llvm.org
Tue Jun 30 12:00:48 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e49d1d9b8702a568baf82e2549e246197ecc334
      https://github.com/llvm/llvm-project/commit/9e49d1d9b8702a568baf82e2549e246197ecc334
  Author: David Green <david.green at arm.com>
  Date:   2020-06-30 (Tue, 30 Jun 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
    M llvm/test/Transforms/InstCombine/fma.ll

  Log Message:
  -----------
  [InstCombine] fma x, y, 0 -> fmul x, y

If the addend of the fma is zero, common sense would suggest that we can
convert fma x, y, 0.0 to fmul x, y. This comes up with some user code
that was expecting the first fma in an unrolled loop to simplify to a
fmul.

Floating point often does not follow naive common sense though. Alive
suggests that this should be guarded by nsz (as fadd -0.0, 0.0 = 0.0).
fma x, y, -0.0 is always valid.

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




More information about the All-commits mailing list