[compiler-rt] r222279 - profile: Robustify instrprof tests

Justin Bogner mail at justinbogner.com
Tue Nov 18 15:03:14 PST 2014


Author: bogner
Date: Tue Nov 18 17:03:14 2014
New Revision: 222279

URL: http://llvm.org/viewvc/llvm-project?rev=222279&view=rev
Log:
profile: Robustify instrprof tests

Change these tests not to rely on the exact metadata numbers the
profile data gets.

Modified:
    compiler-rt/trunk/test/profile/instrprof-basic.c
    compiler-rt/trunk/test/profile/instrprof-set-filename.c
    compiler-rt/trunk/test/profile/instrprof-without-libc.c
    compiler-rt/trunk/test/profile/instrprof-write-file-atexit-explicitly.c
    compiler-rt/trunk/test/profile/instrprof-write-file-only.c
    compiler-rt/trunk/test/profile/instrprof-write-file.c

Modified: compiler-rt/trunk/test/profile/instrprof-basic.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-basic.c?rev=222279&r1=222278&r2=222279&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/instrprof-basic.c (original)
+++ compiler-rt/trunk/test/profile/instrprof-basic.c Tue Nov 18 17:03:14 2014
@@ -4,14 +4,14 @@
 // RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
 
 int begin(int i) {
-  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
   if (i)
     return 0;
   return 1;
 }
 
 int end(int i) {
-  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !2
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
   if (i)
     return 0;
   return 1;
@@ -21,11 +21,11 @@ int main(int argc, const char *argv[]) {
   begin(0);
   end(1);
 
-  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !2
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
   if (argc)
     return 0;
   return 1;
 }
 
-// CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 2}
-// CHECK: !2 = metadata !{metadata !"branch_weights", i32 2, i32 1}
+// CHECK: ![[PD1]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
+// CHECK: ![[PD2]] = metadata !{metadata !"branch_weights", i32 2, i32 1}

Modified: compiler-rt/trunk/test/profile/instrprof-set-filename.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-set-filename.c?rev=222279&r1=222278&r2=222279&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/instrprof-set-filename.c (original)
+++ compiler-rt/trunk/test/profile/instrprof-set-filename.c Tue Nov 18 17:03:14 2014
@@ -5,10 +5,10 @@
 
 void __llvm_profile_set_filename(const char *);
 int main(int argc, const char *argv[]) {
-  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
   if (argc < 2)
     return 1;
   __llvm_profile_set_filename(argv[1]);
   return 0;
 }
-// CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 2}
+// CHECK: ![[PD1]] = metadata !{metadata !"branch_weights", i32 1, i32 2}

Modified: compiler-rt/trunk/test/profile/instrprof-without-libc.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-without-libc.c?rev=222279&r1=222278&r2=222279&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/instrprof-without-libc.c (original)
+++ compiler-rt/trunk/test/profile/instrprof-without-libc.c Tue Nov 18 17:03:14 2014
@@ -18,7 +18,7 @@ int __llvm_profile_write_buffer(char *);
 int write_buffer(uint64_t, const char *);
 int main(int argc, const char *argv[]) {
   // CHECK-LABEL: define {{.*}} @main(
-  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
   if (argc < 2)
     return 1;
 
@@ -46,7 +46,7 @@ int main(int argc, const char *argv[]) {
   return fclose(File);
 #endif
 }
-// CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 2}
+// CHECK: ![[PD1]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
 
 // CHECK-SYMBOLS-NOT: ___cxx_global_var_init
 // CHECK-SYMBOLS-NOT: ___llvm_profile_register_write_file_atexit

Modified: compiler-rt/trunk/test/profile/instrprof-write-file-atexit-explicitly.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-write-file-atexit-explicitly.c?rev=222279&r1=222278&r2=222279&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/instrprof-write-file-atexit-explicitly.c (original)
+++ compiler-rt/trunk/test/profile/instrprof-write-file-atexit-explicitly.c Tue Nov 18 17:03:14 2014
@@ -8,10 +8,10 @@ int __llvm_profile_register_write_file_a
 void __llvm_profile_set_filename(const char *);
 int main(int argc, const char *argv[]) {
   __llvm_profile_register_write_file_atexit();
-  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
   if (argc < 2)
     return 1;
   __llvm_profile_set_filename(argv[1]);
   return 0;
 }
-// CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 2}
+// CHECK: ![[PD1]] = metadata !{metadata !"branch_weights", i32 1, i32 2}

Modified: compiler-rt/trunk/test/profile/instrprof-write-file-only.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-write-file-only.c?rev=222279&r1=222278&r2=222279&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/instrprof-write-file-only.c (original)
+++ compiler-rt/trunk/test/profile/instrprof-write-file-only.c Tue Nov 18 17:03:14 2014
@@ -10,7 +10,7 @@ void __llvm_profile_set_filename(const c
 int foo(int);
 int main(int argc, const char *argv[]) {
   // CHECK-LABEL: define {{.*}} @main(
-  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
   if (argc > 1)
     return 1;
 
@@ -32,4 +32,4 @@ int foo(int X) {
   // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{[^,]+$}}
   return X <= 0 ? -X : X;
 }
-// CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 2}
+// CHECK: ![[PD1]] = metadata !{metadata !"branch_weights", i32 1, i32 2}

Modified: compiler-rt/trunk/test/profile/instrprof-write-file.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-write-file.c?rev=222279&r1=222278&r2=222279&view=diff
==============================================================================
--- compiler-rt/trunk/test/profile/instrprof-write-file.c (original)
+++ compiler-rt/trunk/test/profile/instrprof-write-file.c Tue Nov 18 17:03:14 2014
@@ -10,7 +10,7 @@ void __llvm_profile_set_filename(const c
 int foo(int);
 int main(int argc, const char *argv[]) {
   // CHECK-LABEL: define {{.*}} @main(
-  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
   if (argc < 2)
     return 1;
 
@@ -27,8 +27,8 @@ int main(int argc, const char *argv[]) {
 int foo(int X) {
   // CHECK-LABEL: define {{.*}} @foo(
   // CHECK1: br i1 %{{.*}}, label %{{.*}}, label %{{[^,]+$}}
-  // CHECK2: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !2
+  // CHECK2: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
   return X <= 0 ? -X : X;
 }
-// CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 2}
-// CHECK2: !2 = metadata !{metadata !"branch_weights", i32 2, i32 1}
+// CHECK: ![[PD1]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
+// CHECK2: ![[PD2]] = metadata !{metadata !"branch_weights", i32 2, i32 1}





More information about the llvm-commits mailing list