[llvm] [InstCombine] Optimize powi(X, Y)/ (X * Z) with Ofast (PR #87047)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 29 02:49:10 PDT 2024


================
@@ -401,6 +401,18 @@ define double @fdiv_pow_powi_negative_variable(double %x, i32 %y) {
   ret double %div
 }
 
+; powi(X,C1)/ (X * Z) --> powi(X,C1 - 1)/ Z
----------------
vfdff wrote:

yes, there is 2 steps in the combine
a) powi(X,C1)/ (X * X)  --> powi(X,C1-1)/ X   -- **this patch improves this case**
b) powi(X,C1-1)/ X --> powi(X,C1-2)            -- already supported by prior patch

https://github.com/llvm/llvm-project/pull/87047


More information about the llvm-commits mailing list