[llvm] [InstCombine] Fold fast powi(2.0, x) to ldexp(1.0, x) (PR #202114)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 7 02:54:22 PDT 2026
================
@@ -2518,7 +2518,18 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
return replaceOperand(*II, 0, X);
}
}
+ if (ConstantFP *Base = dyn_cast<ConstantFP>(II->getArgOperand(0))) {
+ Value *Exp = II->getArgOperand(1);
+ // powi(2.0, p) -> ldexp(1.0, p)
+ if (Base->isExactlyValue(2.f) && II->isFast()) {
----------------
Andarwinux wrote:
Isn't requiring IsFast too strict? I think approxFunc is enough.
https://github.com/llvm/llvm-project/pull/202114
More information about the llvm-commits
mailing list