[all-commits] [llvm/llvm-project] c972e2: [NFC][InstCombine] Add sub-of-sub tests with const...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Wed Apr 7 02:08:23 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c972e2d1c29fc248e47f1c502f90472a1c26b256
      https://github.com/llvm/llvm-project/commit/c972e2d1c29fc248e47f1c502f90472a1c26b256
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-04-07 (Wed, 07 Apr 2021)

  Changed paths:
    M llvm/test/Transforms/InstCombine/sub-from-sub.ll

  Log Message:
  -----------
  [NFC][InstCombine] Add sub-of-sub tests with constant expressions

These would cause endless combine loop after 31d219d2997fed1b7dc97e0adf170d5aaf65883e.


  Commit: 93d1d94b745b940c9ad0adf20322eb16ed624ef3
      https://github.com/llvm/llvm-project/commit/93d1d94b745b940c9ad0adf20322eb16ed624ef3
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-04-07 (Wed, 07 Apr 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/test/Transforms/InstCombine/sub-from-sub.ll

  Log Message:
  -----------
  [InstCombine] Restrict "C-(X+C2) --> (C-C2)-X" fold to immediate constants

I.e., if any/all of the consants is an expression, don't do it.
Since those constants won't reduce into an immediate,
but would be left as an constant expression, they could cause
endless combine loops after 31d219d2997fed1b7dc97e0adf170d5aaf65883e
added an inverse transformation.


  Commit: 2829094a8e252d04f13aabdf6f416c42a06af695
      https://github.com/llvm/llvm-project/commit/2829094a8e252d04f13aabdf6f416c42a06af695
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-04-07 (Wed, 07 Apr 2021)

  Changed paths:
    M clang/test/CodeGen/builtins-ppc-quadword-noi128.c
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/test/Transforms/InstCombine/abs-1.ll
    M llvm/test/Transforms/InstCombine/sub-from-sub.ll

  Log Message:
  -----------
  Reland [InstCombine] Fold `((X - Y) - Z)` to `X - (Y + Z)` (PR49858)

This reverts commit a547b4e26b311e417cd51100e379693f51a3f448,
relanding commit 31d219d2997fed1b7dc97e0adf170d5aaf65883e,
which was reverted because there was a conflicting inverse transform,
which was causing an endless combine loop, which has now been adjusted.

Original commit message:

https://alive2.llvm.org/ce/z/67w-wQ

We prefer `add`s over `sub`, and this particular xform
allows further folds to happen:

Fixes https://bugs.llvm.org/show_bug.cgi?id=49858


Compare: https://github.com/llvm/llvm-project/compare/73a7d451a2ca...2829094a8e25


More information about the All-commits mailing list