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

Harrison Hao via All-commits all-commits at lists.llvm.org
Fri Oct 2 19:49:23 PDT 2026


  Branch: refs/heads/users/harrisonGPU/select-pow
  Home:   https://github.com/llvm/llvm-project
  Commit: 6561a75e8000f3d8153d68f4ff0bbe0c1303ac83
      https://github.com/llvm/llvm-project/commit/6561a75e8000f3d8153d68f4ff0bbe0c1303ac83
  Author: Harrison Hao <tsworld1314 at gmail.com>
  Date:   2026-10-03 (Sat, 03 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: 052196058e107ad9a76534e637940b310edcdfdc
      https://github.com/llvm/llvm-project/commit/052196058e107ad9a76534e637940b310edcdfdc
  Author: Harrison Hao <tsworld1314 at gmail.com>
  Date:   2026-10-03 (Sat, 03 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: 90a97424dc7b8c90df516f5f4f2c69cbb4d8891d
      https://github.com/llvm/llvm-project/commit/90a97424dc7b8c90df516f5f4f2c69cbb4d8891d
  Author: Harrison Hao <tsworld1314 at gmail.com>
  Date:   2026-10-03 (Sat, 03 Oct 2026)

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

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


  Commit: 6e9f37d4712e859dbcc1133f59547525e31c6bd5
      https://github.com/llvm/llvm-project/commit/6e9f37d4712e859dbcc1133f59547525e31c6bd5
  Author: Harrison Hao <tsworld1314 at gmail.com>
  Date:   2026-10-03 (Sat, 03 Oct 2026)

  Changed paths:
    M llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pow.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-rootn.ll
    M llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll

  Log Message:
  -----------
  Fix lit test issue.


Compare: https://github.com/llvm/llvm-project/compare/9747c7fbc95e...6e9f37d4712e

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