[all-commits] [llvm/llvm-project] 5ae881: InstCombine: Fold out scale-if-denormal pattern

Matt Arsenault via All-commits all-commits at lists.llvm.org
Fri Sep 1 04:47:26 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5ae881ff0ab3a38121f240c9e73427367284e802
      https://github.com/llvm/llvm-project/commit/5ae881ff0ab3a38121f240c9e73427367284e802
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2023-09-01 (Fri, 01 Sep 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll

  Log Message:
  -----------
  InstCombine: Fold out scale-if-denormal pattern

Fold select (fcmp oeq x, 0), (fmul x, y), x => x

This cleans up a pattern left behind by denormal range checks under
denormals are zero.

The pattern starts out as something like:
  x = x < smallest_normal ? x * K : x;

The comparison folds to an == 0 when the denormal mode treats input
denormals as zero. This makes library denormal checks free after
linked into DAZ enabled code.

alive2 is mostly happy with this, but there are some issues. First,
there are many reported failures in some of the negative tests that
happen to trigger some preexisting canonicalize introducing
combine. Second, alive2 is incorrectly asserting that denormals must
be flushed with the DAZ modes. It's allowed to drop a canonicalize.

https://reviews.llvm.org/D157030




More information about the All-commits mailing list