Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix assertion failure in PR98681 #98860

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/Analysis/ConstantFolding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<float>(std::pow(Op1V.convertToFloat(), Exp)));
if (Ty->isHalfTy()) {
bool Unused;
Res.convert(APFloat::IEEEhalf(), APFloat::rmNearestTiesToEven,
Expand Down
10 changes: 9 additions & 1 deletion llvm/test/Transforms/EarlyCSE/math-2.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
declare double @atan2(double, double) #0
define double @f_atan2() {
; CHECK-LABEL: @f_atan2(
; CHECK-NEXT: ret double 0x3FDDAC6{{.+}}
; CHECK-NEXT: ret double 0x3FDDAC670561BB4F
dtcxzyw marked this conversation as resolved.
Show resolved Hide resolved
;
%res = tail call fast double @atan2(double 1.0, double 2.0)
ret double %res
Expand Down Expand Up @@ -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 }
Loading