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

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 03:52:35 PDT 2023


================
@@ -1764,6 +1764,19 @@ Instruction *InstCombinerImpl::visitFDiv(BinaryOperator &I) {
     return replaceInstUsesWith(I, Pow);
   }
 
+  // powi(X, Y) / X --> powi(X, Y-1)
+  // Todo: Multi-use may be also better off creating Powi(x,y-1)
+  if (I.hasNoInfs() && I.isFast() &&
----------------
vfdff wrote:

Thanks for your  detailed explanation. Now adjust it with **I.hasNoInfs() && I.hasAllowReassoc()**

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


More information about the llvm-commits mailing list