[all-commits] [llvm/llvm-project] 1e9b6b: [InstCombine] convert FP min/max with negated op t...

RotateRight via All-commits all-commits at lists.llvm.org
Wed Jun 23 07:42:55 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1e9b6b89a7b5c49612018b120c2c142106056f82
      https://github.com/llvm/llvm-project/commit/1e9b6b89a7b5c49612018b120c2c142106056f82
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-06-23 (Wed, 23 Jun 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
    M llvm/test/Transforms/InstCombine/maximum.ll
    M llvm/test/Transforms/InstCombine/maxnum.ll
    M llvm/test/Transforms/InstCombine/minimum.ll
    M llvm/test/Transforms/InstCombine/minnum.ll

  Log Message:
  -----------
  [InstCombine] convert FP min/max with negated op to fabs

This is part of improving floating-point patterns seen in:
https://llvm.org/PR39480

We don't require any FMF because the 2 potential corner cases
(-0.0 and NaN) are correctly handled without FMF:
1. -0.0 is treated as strictly less than +0.0 with
   maximum/minimum, so fabs/fneg work as expected.
2. +/- 0.0 with maxnum/minnum is indeterminate, so
   transforming to fabs/fneg is more defined.
3. The sign of a NaN may be altered by this transform,
   but that is allowed in the default FP environment.

If there are FMF, they are propagated from the min/max call to
one or both new operands which seems to agree with Alive2:
https://alive2.llvm.org/ce/z/bem_xC




More information about the All-commits mailing list