[llvm] [IR] Fix llvm.powi intrinsic decl (PR #216160)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 04:04:28 PDT 2026


================
@@ -2511,7 +2511,9 @@ Value *LibCallSimplifier::optimizePow(CallInst *Pow, IRBuilderBase &B) {
   }
 
   // powf(x, itofp(y)) -> powi(x, y)
-  if (AllowApprox && (isa<SIToFPInst>(Expo) || isa<UIToFPInst>(Expo))) {
+  // The powi exponent must be a scalar integer, so a vector y is not usable.
+  if (AllowApprox && !Expo->getType()->isVectorTy() &&
+      (isa<SIToFPInst>(Expo) || isa<UIToFPInst>(Expo))) {
----------------
paulwalker-arm wrote:

Perhaps worth a follow up to add `powf(x, splat(itofp(y)) -> powi(x, y)`?

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


More information about the llvm-commits mailing list