[all-commits] [llvm/llvm-project] 84013e: [InstCombine] Fold fdiv by splat of pow/exp/powi i...
Harrison Hao via All-commits
all-commits at lists.llvm.org
Tue Sep 29 04:17:10 PDT 2026
Branch: refs/heads/users/harrisonGPU/Instcombine/powi-splat-fdiv
Home: https://github.com/llvm/llvm-project
Commit: 84013e32c88648789086ba9a84ecdda7a90cd249
https://github.com/llvm/llvm-project/commit/84013e32c88648789086ba9a84ecdda7a90cd249
Author: Harrison Hao <tsworld1314 at gmail.com>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
M llvm/test/Transforms/InstCombine/fdiv.ll
Log Message:
-----------
[InstCombine] Fold fdiv by splat of pow/exp/powi into fmul
Extend foldFDivPowDivisor to look through a one-use splat divisor. The
exponent is negated on the scalar and the result is splatted again:
$$\frac{Z}{\mathrm{splat}(x^{y})} \to Z \cdot \mathrm{splat}(x^{-y})$$
$$\frac{Z}{\mathrm{splat}(e^{y})} \to Z \cdot \mathrm{splat}(e^{-y})$$
$$\frac{Z}{\mathrm{splat}(2^{y})} \to Z \cdot \mathrm{splat}(2^{-y})$$
$$\frac{Z}{\mathrm{splat}(x^{n})} \to Z \cdot \mathrm{splat}(x^{-n}), \quad n \in \mathbb{Z}\ (\mathrm{powi})$$
Same FMF requirements as the scalar fold: reassoc and arcp, plus ninf
for powi. This removes the reciprocal, e.g. v_rcp on AMDGPU.
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