[llvm] [InstCombine] optimize powi(X,Y) * X with Ofast (PR #69998)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 23 23:58:44 PDT 2023


================
@@ -716,6 +716,18 @@ Instruction *InstCombinerImpl::visitFMul(BinaryOperator &I) {
       return replaceInstUsesWith(I, Pow);
     }
 
+    // powi(X, Y) * X --> powi(X, Y+1)
+    // X * powi(X, Y) --> powi(X, Y+1)
+    if (match(&I, m_c_FMul(m_OneUse(m_Intrinsic<Intrinsic::powi>(m_Value(X),
----------------
vfdff wrote:

hi @arsenm , do you mean both the operation `fmul `and `powi `should have the `reassoc ` ?
  I find all the past combines only check the instruction `I` itself only. 


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


More information about the llvm-commits mailing list