[all-commits] [llvm/llvm-project] e645d1: [InstCombine] Fold select of pow into select of th...

Harrison Hao via All-commits all-commits at lists.llvm.org
Wed Sep 30 11:25:53 PDT 2026


  Branch: refs/heads/users/harrisonGPU/select-pow
  Home:   https://github.com/llvm/llvm-project
  Commit: e645d1b3a74b27f570b34f4e1cbcb6e9e15ae11d
      https://github.com/llvm/llvm-project/commit/e645d1b3a74b27f570b34f4e1cbcb6e9e15ae11d
  Author: Harrison Hao <tsworld1314 at gmail.com>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/intrinsic-select.ll

  Log Message:
  -----------
  [InstCombine] Fold select of pow into select of the differing operand

When both arms of a select are calls to `llvm.pow` with one use that
differ in exactly one operand, sink the select into that operand:

$$
\mathrm{select}(c,\ x^{y},\ x^{z}) \rightarrow x^{\mathrm{select}(c,\ y,\ z)}
$$

$$
\mathrm{select}(c,\ x^{z},\ y^{z}) \rightarrow \mathrm{select}(c,\ x,\ y)^{z}
$$

This removes one `pow` call. FMF are intersected and debug locations
are merged. The transform is skipped when a differing operand is a
constant, since that may enable a cheaper lowering (e.g.
$x^2 \rightarrow x \cdot x$).


  Commit: ea9835e71e9fa0d9062b41b1786736f8eee78e01
      https://github.com/llvm/llvm-project/commit/ea9835e71e9fa0d9062b41b1786736f8eee78e01
  Author: Harrison Hao <tsworld1314 at gmail.com>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/select-fcmp-fmul-zero-absorbing-value.ll

  Log Message:
  -----------
  Use TriviallyVectorizable


  Commit: 1e6a9ee6ad5e3f831f1e88d8dcf6f67fb87399f4
      https://github.com/llvm/llvm-project/commit/1e6a9ee6ad5e3f831f1e88d8dcf6f67fb87399f4
  Author: Harrison Hao <tsworld1314 at gmail.com>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/intrinsic-select.ll

  Log Message:
  -----------
  Update for comments


Compare: https://github.com/llvm/llvm-project/compare/b1a304804a91...1e6a9ee6ad5e

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