[all-commits] [llvm/llvm-project] 857d8d: [InstCombine] Fix FMF propagation in `foldSelectWi...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Thu Feb 6 17:02:43 PST 2025


  Branch: refs/heads/release/20.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 857d8d767ab2f3c5f08f9710e98aa5fd1b1dff66
      https://github.com/llvm/llvm-project/commit/857d8d767ab2f3c5f08f9710e98aa5fd1b1dff66
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2025-02-06 (Thu, 06 Feb 2025)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/fabs.ll
    M llvm/test/Transforms/InstCombine/fneg-fabs.ll

  Log Message:
  -----------
  [InstCombine] Fix FMF propagation in `foldSelectWithFCmpToFabs` (#121580)

Consider the following pattern:
```
%cmp = fcmp <pred> double %x, 0.000000e+00
%negX = fneg <fmf> double %x
%sel = select i1 %cmp, double %x, double %negX
```
We cannot propagate ninf from fneg to select since `%negX` may not be
chosen. Similarly, we cannot propagate nnan unless `%negX` is guaranteed
to be selected when `%x` is NaN.
This patch also propagates nnan/ninf from fcmp to avoid regression in
`PhaseOrdering/generate-fabs.ll`.

Alive2: https://alive2.llvm.org/ce/z/t6U-tA
Closes https://github.com/llvm/llvm-project/issues/121430 and
https://github.com/llvm/llvm-project/issues/113989.

(cherry picked from commit 3ec6a6b85aed838b7d56bd6843cad52e822b9111)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list