diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 6c52091cd5d75..df75745645e04 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -2759,7 +2759,7 @@ static Constant *ConstantFoldIntrinsicCall2(Intrinsic::ID IntrinsicID, Type *Ty, switch (Ty->getTypeID()) { case Type::HalfTyID: case Type::FloatTyID: { - APFloat Res(std::pow(Op1V.convertToFloat(), Exp)); + APFloat Res(static_cast(std::pow(Op1V.convertToFloat(), Exp))); if (Ty->isHalfTy()) { bool Unused; Res.convert(APFloat::IEEEhalf(), APFloat::rmNearestTiesToEven, diff --git a/llvm/test/Transforms/EarlyCSE/math-2.ll b/llvm/test/Transforms/EarlyCSE/math-2.ll index 60a2f19084c83..0d55165e3662f 100644 --- a/llvm/test/Transforms/EarlyCSE/math-2.ll +++ b/llvm/test/Transforms/EarlyCSE/math-2.ll @@ -108,4 +108,12 @@ define half @pr98665() { ret half %x } +define float @powi_f32() { +; CHECK-LABEL: @powi_f32( +; CHECK-NEXT: ret float 0.000000e+00 +; + %y = call float @llvm.powi.f32.i32(float 0.0, i32 10) + ret float %y +} + attributes #0 = { nofree nounwind willreturn }