[all-commits] [llvm/llvm-project] 098520: [InstCombine] optimize powi(X, Y) * X with Ofast

Allen via All-commits all-commits at lists.llvm.org
Thu Mar 14 07:07:02 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 098520244f90e9330d3ae78bd1061aee2e3688c0
      https://github.com/llvm/llvm-project/commit/098520244f90e9330d3ae78bd1061aee2e3688c0
  Author: zhongyunde 00443407 <zhongyunde at huawei.com>
  Date:   2024-03-14 (Thu, 14 Mar 2024)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
    M llvm/test/Transforms/InstCombine/powi.ll

  Log Message:
  -----------
  [InstCombine] optimize powi(X,Y) * X with Ofast

Try to transform the powi(X, Y) * X into powi(X, Y+1) with Ofast

For this case, when the Y is 3, then powi(X, 4) is replaced by
X2 = X * X; X2 * X2 in the further step.
Similar to D109954, who requires reassoc.

Fixes https://github.com/llvm/llvm-project/issues/69862.


  Commit: 1752b9e4c74bda8bb312dadec0dae007c877e28c
      https://github.com/llvm/llvm-project/commit/1752b9e4c74bda8bb312dadec0dae007c877e28c
  Author: zhongyunde 00443407 <zhongyunde at huawei.com>
  Date:   2024-03-14 (Thu, 14 Mar 2024)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp

  Log Message:
  -----------
  [InstCombine] create a helper function foldPowiReassoc, NFC


  Commit: 2d6988a45e29aec9242f96b3ab02a3c3699bc3ec
      https://github.com/llvm/llvm-project/commit/2d6988a45e29aec9242f96b3ab02a3c3699bc3ec
  Author: zhongyunde 00443407 <zhongyunde at huawei.com>
  Date:   2024-03-14 (Thu, 14 Mar 2024)

  Changed paths:
    M llvm/include/llvm/IR/PatternMatch.h
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
    M llvm/test/Transforms/InstCombine/powi.ll

  Log Message:
  -----------
  [InstCombine] Add restrict reassoc for the operands of fmul

According the discussion, except the fmul itself, all its operands
should also have reassoc flag.
Add new API m_AllowReassoc to check reassoc flag


Compare: https://github.com/llvm/llvm-project/compare/160693dbde28...2d6988a45e29

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