Skip to content

Commit

Permalink
[InstSimplify] Add willreturn to more libcall tests (NFC)
Browse files Browse the repository at this point in the history
Annotate more math libcalls with willreturn. The attribute would
have been added by the InferFuncAttrs.
  • Loading branch information
nikic committed Jan 22, 2021
1 parent 430d43e commit fdab28e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
34 changes: 18 additions & 16 deletions llvm/test/Transforms/InstSimplify/ConstProp/math-1.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -early-cse -earlycse-debug-hash -S -o - %s | FileCheck %s

declare double @acos(double)
declare double @acos(double) #0
define double @f_acos() {
; CHECK-LABEL: @f_acos(
; CHECK-NEXT: ret double 0.000000e+00
Expand All @@ -10,7 +10,7 @@ define double @f_acos() {
ret double %res
}

declare float @asinf(float)
declare float @asinf(float) #0
define float @f_asinf() {
; CHECK-LABEL: @f_asinf(
; CHECK-NEXT: ret float 0x3FF921FB{{.+}}
Expand All @@ -19,7 +19,7 @@ define float @f_asinf() {
ret float %res
}

declare double @atan(double)
declare double @atan(double) #0
define double @f_atan() {
; CHECK-LABEL: @f_atan(
; CHECK-NEXT: [[RES:%.*]] = tail call fast double @atan(double 1.000000e+00)
Expand All @@ -29,7 +29,7 @@ define double @f_atan() {
ret double %res
}

declare float @cosf(float)
declare float @cosf(float) #0
define float @f_cosf() {
; CHECK-LABEL: @f_cosf(
; CHECK-NEXT: ret float 0x3FE14A2{{.+}}
Expand All @@ -47,7 +47,7 @@ define float @i_cosf() {
ret float %res
}

declare double @cosh(double)
declare double @cosh(double) #0
define double @f_cosh() {
; CHECK-LABEL: @f_cosh(
; CHECK-NEXT: ret double 0x3FF8B075{{.+}}
Expand All @@ -56,7 +56,7 @@ define double @f_cosh() {
ret double %res
}

declare float @expf(float)
declare float @expf(float) #0
define float @f_expf() {
; CHECK-LABEL: @f_expf(
; CHECK-NEXT: ret float 0x4005BF0A{{.+}}
Expand All @@ -74,7 +74,7 @@ define float @i_expf() {
ret float %res
}

declare double @exp2(double)
declare double @exp2(double) #0
define double @f_exp2() {
; CHECK-LABEL: @f_exp2(
; CHECK-NEXT: ret double 2.000000e+00
Expand All @@ -93,7 +93,7 @@ define double @i_exp2() {
}

; FIXME: exp10() is not widely supported.
declare float @exp10f(float)
declare float @exp10f(float) #0
define float @f_exp10f() {
; CHECK-LABEL: @f_exp10f(
; CHECK-NEXT: [[RES:%.*]] = tail call float @exp10f(float 1.000000e+00)
Expand All @@ -103,7 +103,7 @@ define float @f_exp10f() {
ret float %res
}

declare double @log(double)
declare double @log(double) #0
define double @f_log() {
; CHECK-LABEL: @f_log(
; CHECK-NEXT: ret double 0.000000e+00
Expand All @@ -121,7 +121,7 @@ define double @i_log() {
ret double %res
}

declare float @log2f(float)
declare float @log2f(float) #0
define float @f_log2f() {
; CHECK-LABEL: @f_log2f(
; CHECK-NEXT: ret float 0.000000e+00
Expand All @@ -139,7 +139,7 @@ define float @i_log2f() {
ret float %res
}

declare double @log10(double)
declare double @log10(double) #0
define double @f_log10() {
; CHECK-LABEL: @f_log10(
; CHECK-NEXT: ret double 0.000000e+00
Expand All @@ -148,7 +148,7 @@ define double @f_log10() {
ret double %res
}

declare float @sinf(float)
declare float @sinf(float) #0
define float @f_sinf() {
; CHECK-LABEL: @f_sinf(
; CHECK-NEXT: ret float 0x3FEAED54{{.+}}
Expand All @@ -157,7 +157,7 @@ define float @f_sinf() {
ret float %res
}

declare double @sinh(double)
declare double @sinh(double) #0
define double @f_sinh() {
; CHECK-LABEL: @f_sinh(
; CHECK-NEXT: ret double 0x3FF2CD9F{{.+}}
Expand All @@ -166,7 +166,7 @@ define double @f_sinh() {
ret double %res
}

declare float @sqrtf(float)
declare float @sqrtf(float) #0
define float @f_sqrtf() {
; CHECK-LABEL: @f_sqrtf(
; CHECK-NEXT: ret float 1.000000e+00
Expand All @@ -175,7 +175,7 @@ define float @f_sqrtf() {
ret float %res
}

declare double @tan(double)
declare double @tan(double) #0
define double @f_tan() {
; CHECK-LABEL: @f_tan(
; CHECK-NEXT: ret double 0x3FF8EB24{{.+}}
Expand All @@ -184,7 +184,7 @@ define double @f_tan() {
ret double %res
}

declare float @tanhf(float)
declare float @tanhf(float) #0
define float @f_tanhf() {
; CHECK-LABEL: @f_tanhf(
; CHECK-NEXT: [[RES:%.*]] = tail call fast float @tanhf(float 1.000000e+00)
Expand All @@ -193,3 +193,5 @@ define float @f_tanhf() {
%res = tail call fast float @tanhf(float 1.0)
ret float %res
}

attributes #0 = { nofree nounwind willreturn }
12 changes: 7 additions & 5 deletions llvm/test/Transforms/InstSimplify/ConstProp/math-2.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -early-cse -earlycse-debug-hash -S -o - %s | FileCheck %s

declare double @atan2(double, double)
declare double @atan2(double, double) #0
define double @f_atan2() {
; CHECK-LABEL: @f_atan2(
; CHECK-NEXT: [[RES:%.*]] = tail call fast double @atan2(double 1.000000e+00, double 2.000000e+00)
Expand All @@ -11,7 +11,7 @@ define double @f_atan2() {
ret double %res
}

declare float @fmodf(float, float)
declare float @fmodf(float, float) #0
define float @f_fmodf() {
; CHECK-LABEL: @f_fmodf(
; CHECK-NEXT: ret float 1.000000e+00
Expand All @@ -20,7 +20,7 @@ define float @f_fmodf() {
ret float %res
}

declare float @remainderf(float, float)
declare float @remainderf(float, float) #0
define float @f_remainderf_fold1() {
; CHECK-LABEL: @f_remainderf_fold1(
; CHECK-NEXT: ret float 1.000000e+00
Expand All @@ -46,7 +46,7 @@ define float @f_remainderf_nofold() {
ret float %res
}

declare double @remainder(double, double)
declare double @remainder(double, double) #0
define double @f_remainder_fold1() {
; CHECK-LABEL: @f_remainder_fold1(
; CHECK-NEXT: ret double 1.000000e+00
Expand All @@ -72,7 +72,7 @@ define double @f_remainder_nofold() {
ret double %res
}

declare double @pow(double, double)
declare double @pow(double, double) #0
define double @f_pow() {
; CHECK-LABEL: @f_pow(
; CHECK-NEXT: ret double 1.000000e+00
Expand All @@ -98,3 +98,5 @@ define double @i_powi() {
%res = tail call fast double @llvm.powi.f64(double 1.0, i32 2)
ret double %res
}

attributes #0 = { nofree nounwind willreturn }

0 comments on commit fdab28e

Please sign in to comment.