[llvm] SimplifyLibCalls: Prefer to emit intrinsic in pow(2, x) -> ldexp(1, x) (PR #92363)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri May 17 05:25:49 PDT 2024
================
@@ -2092,11 +2092,19 @@ Value *LibCallSimplifier::replacePowWithExp(CallInst *Pow, IRBuilderBase &B) {
if (!Ty->isVectorTy() && match(Base, m_SpecificFP(2.0)) &&
(isa<SIToFPInst>(Expo) || isa<UIToFPInst>(Expo)) &&
hasFloatFn(M, TLI, Ty, LibFunc_ldexp, LibFunc_ldexpf, LibFunc_ldexpl)) {
- if (Value *ExpoI = getIntToFPVal(Expo, B, TLI->getIntSize()))
- return copyFlags(*Pow,
- emitBinaryFloatFnCall(ConstantFP::get(Ty, 1.0), ExpoI,
- TLI, LibFunc_ldexp, LibFunc_ldexpf,
- LibFunc_ldexpl, B, NoAttrs));
+ if (Value *ExpoI = getIntToFPVal(Expo, B, TLI->getIntSize())) {
+ Constant *One = ConstantFP::get(Ty, 1.0);
+
+ if (Pow->doesNotAccessMemory()) {
----------------
arsenm wrote:
It's multiple lines
https://github.com/llvm/llvm-project/pull/92363
More information about the llvm-commits
mailing list