[llvm-branch-commits] [llvm] 9d27962 - [Tests] Add willreturn to libcalls in some tests

Nikita Popov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 22 12:52:35 PST 2021


Author: Nikita Popov
Date: 2021-01-22T21:47:35+01:00
New Revision: 9d2796210f71f95d0c62337c130a455694ce99a5

URL: https://github.com/llvm/llvm-project/commit/9d2796210f71f95d0c62337c130a455694ce99a5
DIFF: https://github.com/llvm/llvm-project/commit/9d2796210f71f95d0c62337c130a455694ce99a5.diff

LOG: [Tests] Add willreturn to libcalls in some tests

Willreturn would be inferred by FuncAttrs for these. Annotate them
to preserve test behavior in the future.

Added: 
    

Modified: 
    llvm/test/Transforms/Attributor/nonnull.ll
    llvm/test/Transforms/DCE/calls-errno.ll
    llvm/test/Transforms/InstSimplify/ConstProp/calls-math-finite.ll
    llvm/test/Transforms/InstSimplify/ConstProp/calls.ll
    llvm/test/Transforms/InstSimplify/ConstProp/round.ll
    llvm/test/Transforms/InstSimplify/ConstProp/trunc.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/Attributor/nonnull.ll b/llvm/test/Transforms/Attributor/nonnull.ll
index cc3ae684b09f..3c836e4e5c28 100644
--- a/llvm/test/Transforms/Attributor/nonnull.ll
+++ b/llvm/test/Transforms/Attributor/nonnull.ll
@@ -1513,23 +1513,23 @@ define void @PR43833_simple(i32* %0, i32 %1) {
   br i1 %11, label %7, label %8
 }
 
-declare i8* @strrchr(i8* %0, i32 %1) nofree nounwind readonly
+declare i8* @strrchr(i8* %0, i32 %1) nofree nounwind readonly willreturn
 
 ; We should not mark the return of @strrchr as `nonnull`, it may well be NULL!
 define i8* @mybasename(i8* nofree readonly %str) {
-; NOT_CGSCC_OPM: Function Attrs: nofree nounwind readonly
+; NOT_CGSCC_OPM: Function Attrs: nofree nounwind readonly willreturn
 ; NOT_CGSCC_OPM-LABEL: define {{[^@]+}}@mybasename
 ; NOT_CGSCC_OPM-SAME: (i8* nofree readonly [[STR:%.*]]) [[ATTR11:#.*]] {
-; NOT_CGSCC_OPM-NEXT:    [[CALL:%.*]] = call i8* @strrchr(i8* nofree readonly [[STR]], i32 noundef 47) [[ATTR14]]
+; NOT_CGSCC_OPM-NEXT:    [[CALL:%.*]] = call i8* @strrchr(i8* nofree readonly [[STR]], i32 noundef 47) [[ATTR15:#.*]]
 ; NOT_CGSCC_OPM-NEXT:    [[TOBOOL:%.*]] = icmp ne i8* [[CALL]], null
 ; NOT_CGSCC_OPM-NEXT:    [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[CALL]], i64 1
 ; NOT_CGSCC_OPM-NEXT:    [[COND:%.*]] = select i1 [[TOBOOL]], i8* [[ADD_PTR]], i8* [[STR]]
 ; NOT_CGSCC_OPM-NEXT:    ret i8* [[COND]]
 ;
-; IS__CGSCC_OPM: Function Attrs: nofree nounwind readonly
+; IS__CGSCC_OPM: Function Attrs: nofree nounwind readonly willreturn
 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@mybasename
 ; IS__CGSCC_OPM-SAME: (i8* nofree readonly [[STR:%.*]]) [[ATTR12:#.*]] {
-; IS__CGSCC_OPM-NEXT:    [[CALL:%.*]] = call i8* @strrchr(i8* nofree readonly [[STR]], i32 noundef 47) [[ATTR15]]
+; IS__CGSCC_OPM-NEXT:    [[CALL:%.*]] = call i8* @strrchr(i8* nofree readonly [[STR]], i32 noundef 47) [[ATTR16:#.*]]
 ; IS__CGSCC_OPM-NEXT:    [[TOBOOL:%.*]] = icmp ne i8* [[CALL]], null
 ; IS__CGSCC_OPM-NEXT:    [[ADD_PTR:%.*]] = getelementptr inbounds i8, i8* [[CALL]], i64 1
 ; IS__CGSCC_OPM-NEXT:    [[COND:%.*]] = select i1 [[TOBOOL]], i8* [[ADD_PTR]], i8* [[STR]]

diff  --git a/llvm/test/Transforms/DCE/calls-errno.ll b/llvm/test/Transforms/DCE/calls-errno.ll
index 77f048c03aa0..f0dce672e213 100644
--- a/llvm/test/Transforms/DCE/calls-errno.ll
+++ b/llvm/test/Transforms/DCE/calls-errno.ll
@@ -1,59 +1,66 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt < %s -dce -S | FileCheck %s
 ; RUN: opt < %s -passes=dce -S | FileCheck %s
 
-declare double @acos(double) nounwind
-declare double @asin(double) nounwind
-declare double @atan(double) nounwind
-declare double @atan2(double, double) nounwind
-declare double @ceil(double) nounwind
-declare double @cos(double) nounwind
-declare double @cosh(double) nounwind
-declare double @exp(double) nounwind
-declare double @exp2(double) nounwind
-declare double @fabs(double) nounwind
-declare double @floor(double) nounwind
-declare double @fmod(double, double) nounwind
-declare double @log(double) nounwind
-declare double @log10(double) nounwind
-declare double @pow(double, double) nounwind
-declare double @sin(double) nounwind
-declare double @sinh(double) nounwind
-declare double @sqrt(double) nounwind
-declare double @tan(double) nounwind
-declare double @tanh(double) nounwind
-
-declare float @acosf(float) nounwind
-declare float @asinf(float) nounwind
-declare float @atanf(float) nounwind
-declare float @atan2f(float, float) nounwind
-declare float @ceilf(float) nounwind
-declare float @cosf(float) nounwind
-declare float @coshf(float) nounwind
-declare float @expf(float) nounwind
-declare float @exp2f(float) nounwind
-declare float @fabsf(float) nounwind
-declare float @floorf(float) nounwind
-declare float @fmodf(float, float) nounwind
-declare float @logf(float) nounwind
-declare float @log10f(float) nounwind
-declare float @powf(float, float) nounwind
-declare float @sinf(float) nounwind
-declare float @sinhf(float) nounwind
-declare float @sqrtf(float) nounwind
-declare float @tanf(float) nounwind
-declare float @tanhf(float) nounwind
+declare double @acos(double) nounwind willreturn
+declare double @asin(double) nounwind willreturn
+declare double @atan(double) nounwind willreturn
+declare double @atan2(double, double) nounwind willreturn
+declare double @ceil(double) nounwind willreturn
+declare double @cos(double) nounwind willreturn
+declare double @cosh(double) nounwind willreturn
+declare double @exp(double) nounwind willreturn
+declare double @exp2(double) nounwind willreturn
+declare double @fabs(double) nounwind willreturn
+declare double @floor(double) nounwind willreturn
+declare double @fmod(double, double) nounwind willreturn
+declare double @log(double) nounwind willreturn
+declare double @log10(double) nounwind willreturn
+declare double @pow(double, double) nounwind willreturn
+declare double @sin(double) nounwind willreturn
+declare double @sinh(double) nounwind willreturn
+declare double @sqrt(double) nounwind willreturn
+declare double @tan(double) nounwind willreturn
+declare double @tanh(double) nounwind willreturn
+
+declare float @acosf(float) nounwind willreturn
+declare float @asinf(float) nounwind willreturn
+declare float @atanf(float) nounwind willreturn
+declare float @atan2f(float, float) nounwind willreturn
+declare float @ceilf(float) nounwind willreturn
+declare float @cosf(float) nounwind willreturn
+declare float @coshf(float) nounwind willreturn
+declare float @expf(float) nounwind willreturn
+declare float @exp2f(float) nounwind willreturn
+declare float @fabsf(float) nounwind willreturn
+declare float @floorf(float) nounwind willreturn
+declare float @fmodf(float, float) nounwind willreturn
+declare float @logf(float) nounwind willreturn
+declare float @log10f(float) nounwind willreturn willreturn
+declare float @powf(float, float) nounwind willreturn
+declare float @sinf(float) nounwind willreturn
+declare float @sinhf(float) nounwind willreturn
+declare float @sqrtf(float) nounwind willreturn
+declare float @tanf(float) nounwind willreturn
+declare float @tanhf(float) nounwind willreturn
 
 define void @T() {
-entry:
 ; CHECK-LABEL: @T(
-; CHECK-NEXT: entry:
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[LOG1:%.*]] = call double @log(double 0.000000e+00)
+; CHECK-NEXT:    [[LOG2:%.*]] = call double @log(double -1.000000e+00)
+; CHECK-NEXT:    [[EXP2:%.*]] = call double @exp(double 1.000000e+03)
+; CHECK-NEXT:    [[COS2:%.*]] = call double @cos(double 0x7FF0000000000000)
+; CHECK-NEXT:    [[COS3:%.*]] = call double @cos(double 0.000000e+00) [[ATTR2:#.*]]
+; CHECK-NEXT:    [[FMOD2:%.*]] = call double @fmod(double 0x7FF0000000000000, double 1.000000e+00)
+; CHECK-NEXT:    ret void
+;
+entry:
 
 ; log(0) produces a pole error
-; CHECK-NEXT: %log1 = call double @log(double 0.000000e+00)
   %log1 = call double @log(double 0.000000e+00)
 
 ; log(-1) produces a domain error
-; CHECK-NEXT: %log2 = call double @log(double -1.000000e+00)
   %log2 = call double @log(double -1.000000e+00)
 
 ; log(1) is 0
@@ -63,18 +70,15 @@ entry:
   %exp1 = call double @exp(double 1.000000e+02)
 
 ; exp(1000) is a range error
-; CHECK-NEXT: %exp2 = call double @exp(double 1.000000e+03)
   %exp2 = call double @exp(double 1.000000e+03)
 
 ; cos(0) is 1
   %cos1 = call double @cos(double 0.000000e+00)
 
 ; cos(inf) is a domain error
-; CHECK-NEXT: %cos2 = call double @cos(double 0x7FF0000000000000)
   %cos2 = call double @cos(double 0x7FF0000000000000)
 
-; cos(0) nobuiltin may have side effects 
-; CHECK-NEXT: %cos3 = call double @cos(double 0.000000e+00)
+; cos(0) nobuiltin may have side effects
   %cos3 = call double @cos(double 0.000000e+00) nobuiltin
 
 ; pow(0, 1) is 0
@@ -88,22 +92,21 @@ entry:
   %fmod1 = call double @fmod(double 0x7FF0000000000000, double 0x7FF0000000000001)
 
 ; fmod(inf, 1) is a domain error
-; CHECK-NEXT: %fmod2 = call double @fmod(double 0x7FF0000000000000, double 1.000000e+00)
   %fmod2 = call double @fmod(double 0x7FF0000000000000, double 1.000000e+00)
 
-; CHECK-NEXT: ret void
   ret void
 }
 
 define void @Tstrict() strictfp {
-entry:
 ; CHECK-LABEL: @Tstrict(
-; CHECK-NEXT: entry:
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[COS4:%.*]] = call double @cos(double 1.000000e+00) [[ATTR1:#.*]]
+; CHECK-NEXT:    ret void
+;
+entry:
 
 ; cos(1) strictfp sets FP status flags
-; CHECK-NEXT: %cos4 = call double @cos(double 1.000000e+00)
   %cos4 = call double @cos(double 1.000000e+00) strictfp
 
-; CHECK-NEXT: ret void
   ret void
 }

diff  --git a/llvm/test/Transforms/InstSimplify/ConstProp/calls-math-finite.ll b/llvm/test/Transforms/InstSimplify/ConstProp/calls-math-finite.ll
index 307324640000..8d18d9a145a2 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/calls-math-finite.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/calls-math-finite.ll
@@ -30,7 +30,7 @@ declare float @__powf_finite(float, float) #0
 declare double @__sinh_finite(double) #0
 declare float @__sinhf_finite(float) #0
 
-attributes #0 = { nounwind readnone }
+attributes #0 = { nounwind readnone willreturn }
 
 define void @T() {
 ; CHECK-LABEL: @T(

diff  --git a/llvm/test/Transforms/InstSimplify/ConstProp/calls.ll b/llvm/test/Transforms/InstSimplify/ConstProp/calls.ll
index 84aa7c2913a2..92115d4f9bf7 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/calls.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/calls.ll
@@ -1,49 +1,49 @@
 ; RUN: opt < %s -instsimplify -S | FileCheck %s
 ; RUN: opt < %s -instsimplify -disable-simplify-libcalls -S | FileCheck %s --check-prefix=FNOBUILTIN
 
-declare double @acos(double) readnone nounwind
-declare double @asin(double) readnone nounwind
-declare double @atan(double) readnone nounwind
-declare double @atan2(double, double) readnone nounwind
-declare double @ceil(double) readnone nounwind
-declare double @cos(double) readnone nounwind
-declare double @cosh(double) readnone nounwind
-declare double @exp(double) readnone nounwind
-declare double @exp2(double) readnone nounwind
-declare double @fabs(double) readnone nounwind
-declare double @floor(double) readnone nounwind
-declare double @fmod(double, double) readnone nounwind
-declare double @log(double) readnone nounwind
-declare double @log10(double) readnone nounwind
-declare double @pow(double, double) readnone nounwind
-declare double @round(double) readnone nounwind
-declare double @sin(double) readnone nounwind
-declare double @sinh(double) readnone nounwind
-declare double @sqrt(double) readnone nounwind
-declare double @tan(double) readnone nounwind
-declare double @tanh(double) readnone nounwind
+declare double @acos(double) readnone nounwind willreturn
+declare double @asin(double) readnone nounwind willreturn
+declare double @atan(double) readnone nounwind willreturn
+declare double @atan2(double, double) readnone nounwind willreturn
+declare double @ceil(double) readnone nounwind willreturn
+declare double @cos(double) readnone nounwind willreturn
+declare double @cosh(double) readnone nounwind willreturn
+declare double @exp(double) readnone nounwind willreturn
+declare double @exp2(double) readnone nounwind willreturn
+declare double @fabs(double) readnone nounwind willreturn
+declare double @floor(double) readnone nounwind willreturn
+declare double @fmod(double, double) readnone nounwind willreturn
+declare double @log(double) readnone nounwind willreturn
+declare double @log10(double) readnone nounwind willreturn
+declare double @pow(double, double) readnone nounwind willreturn
+declare double @round(double) readnone nounwind willreturn
+declare double @sin(double) readnone nounwind willreturn
+declare double @sinh(double) readnone nounwind willreturn
+declare double @sqrt(double) readnone nounwind willreturn
+declare double @tan(double) readnone nounwind willreturn
+declare double @tanh(double) readnone nounwind willreturn
 
-declare float @acosf(float) readnone nounwind
-declare float @asinf(float) readnone nounwind
-declare float @atanf(float) readnone nounwind
-declare float @atan2f(float, float) readnone nounwind
-declare float @ceilf(float) readnone nounwind
-declare float @cosf(float) readnone nounwind
-declare float @coshf(float) readnone nounwind
-declare float @expf(float) readnone nounwind
-declare float @exp2f(float) readnone nounwind
-declare float @fabsf(float) readnone nounwind
-declare float @floorf(float) readnone nounwind
-declare float @fmodf(float, float) readnone nounwind
-declare float @logf(float) readnone nounwind
-declare float @log10f(float) readnone nounwind
-declare float @powf(float, float) readnone nounwind
-declare float @roundf(float) readnone nounwind
-declare float @sinf(float) readnone nounwind
-declare float @sinhf(float) readnone nounwind
-declare float @sqrtf(float) readnone nounwind
-declare float @tanf(float) readnone nounwind
-declare float @tanhf(float) readnone nounwind
+declare float @acosf(float) readnone nounwind willreturn
+declare float @asinf(float) readnone nounwind willreturn
+declare float @atanf(float) readnone nounwind willreturn
+declare float @atan2f(float, float) readnone nounwind willreturn
+declare float @ceilf(float) readnone nounwind willreturn
+declare float @cosf(float) readnone nounwind willreturn
+declare float @coshf(float) readnone nounwind willreturn
+declare float @expf(float) readnone nounwind willreturn
+declare float @exp2f(float) readnone nounwind willreturn
+declare float @fabsf(float) readnone nounwind willreturn
+declare float @floorf(float) readnone nounwind willreturn
+declare float @fmodf(float, float) readnone nounwind willreturn
+declare float @logf(float) readnone nounwind willreturn
+declare float @log10f(float) readnone nounwind willreturn
+declare float @powf(float, float) readnone nounwind willreturn
+declare float @roundf(float) readnone nounwind willreturn
+declare float @sinf(float) readnone nounwind willreturn
+declare float @sinhf(float) readnone nounwind willreturn
+declare float @sqrtf(float) readnone nounwind willreturn
+declare float @tanf(float) readnone nounwind willreturn
+declare float @tanhf(float) readnone nounwind willreturn
 
 define double @T() {
 ; CHECK-LABEL: @T(

diff  --git a/llvm/test/Transforms/InstSimplify/ConstProp/round.ll b/llvm/test/Transforms/InstSimplify/ConstProp/round.ll
index 6d9a89a69021..e24750e7f30c 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/round.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/round.ll
@@ -1,9 +1,9 @@
 ; RUN: opt -S -early-cse -earlycse-debug-hash < %s | FileCheck %s
 
 declare float @roundf(float) #0
-declare float @llvm.round.f32(float) #0
+declare float @llvm.round.f32(float)
 declare double @round(double) #0
-declare double @llvm.round.f64(double) #0
+declare double @llvm.round.f64(double)
 
 ; CHECK-LABEL: @constant_fold_round_f32_01
 ; CHECK-NEXT: ret float 1.000000e+00
@@ -89,4 +89,4 @@ define double @constant_fold_round_f64_06() #0 {
   ret double %x
 }
 
-attributes #0 = { nounwind readnone }
+attributes #0 = { nounwind readnone willreturn }

diff  --git a/llvm/test/Transforms/InstSimplify/ConstProp/trunc.ll b/llvm/test/Transforms/InstSimplify/ConstProp/trunc.ll
index 3548e95620be..b7ba65f0893e 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/trunc.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/trunc.ll
@@ -2,9 +2,9 @@
 ; RUN: opt -S -early-cse -earlycse-debug-hash < %s | FileCheck %s
 
 declare float @truncf(float) #0
-declare float @llvm.trunc.f32(float) #0
+declare float @llvm.trunc.f32(float)
 declare double @trunc(double) #0
-declare double @llvm.trunc.f64(double) #0
+declare double @llvm.trunc.f64(double)
 
 define float @constant_fold_trunc_f32_01() #0 {
 ; CHECK-LABEL: @constant_fold_trunc_f32_01(
@@ -102,4 +102,4 @@ define double @constant_fold_trunc_f64_06() #0 {
   ret double %x
 }
 
-attributes #0 = { nounwind readnone }
+attributes #0 = { nounwind readnone willreturn }


        


More information about the llvm-branch-commits mailing list