Merged
Conversation
Member
|
@llvm/pr-subscribers-llvm-analysis @llvm/pr-subscribers-llvm-transforms Author: Yingwei Zheng (dtcxzyw) ChangesSee https://en.cppreference.com/w/cpp/numeric/math/pow: Full diff: https://github.com/llvm/llvm-project/pull/98860.diff 2 Files Affected:
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<float>(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..7e4522a58beaf 100644
--- a/llvm/test/Transforms/EarlyCSE/math-2.ll
+++ b/llvm/test/Transforms/EarlyCSE/math-2.ll
@@ -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
;
%res = tail call fast double @atan2(double 1.0, double 2.0)
ret double %res
@@ -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 }
|
dtcxzyw
commented
Jul 15, 2024
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/123/builds/1806 Here is the relevant piece of the build log for the reference: |
Member
|
To avoid this problem from happening again, I think we should replace the double and float constructors with class methods at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See https://en.cppreference.com/w/cpp/numeric/math/pow: