[llvm] [InstCombine] optimize powi(X,Y)/X with Ofast (PR #67236)

via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 23 06:07:05 PDT 2023


================
@@ -1764,6 +1764,16 @@ Instruction *InstCombinerImpl::visitFDiv(BinaryOperator &I) {
     return replaceInstUsesWith(I, Pow);
   }
 
+  if (I.hasAllowReassoc() && I.hasNoInfs() &&
+      match(Op0, m_OneUse(m_Intrinsic<Intrinsic::powi>(m_Specific(Op1),
+                                                       m_Value(Y))))) {
----------------
goldsteinn wrote:

Although a bit more complicated, I'd guess even multi-use we would be better off creating Powi(x,y-1) then creating (multiple, Powi(x,y-1),x) to replace the Powi(x,y). Maybe add Todo for that at very least?

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


More information about the llvm-commits mailing list