From: Xinliang David Li Date: Thu, 28 Jan 2016 18:25:53 +0000 (+0000) Subject: [PGO] test case cleanups X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c599c9b4378f4d99500959895159e4dd26980ee6;p=clang [PGO] test case cleanups 1. Make test case more focused and robust by focusing on what to be tested (linkage, icall) -- make it easier to validate 2. Testing linkages of data and counter variables instead of names. Counters and data are more relavant to be tested. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259067 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Profile/c-indirect-call.c b/test/Profile/c-indirect-call.c index 0d8f3babdb..d73d09a9a1 100644 --- a/test/Profile/c-indirect-call.c +++ b/test/Profile/c-indirect-call.c @@ -7,7 +7,7 @@ int main(void) { // CHECK: [[REG1:%[0-9]+]] = load void ()*, void ()** @foo, align 8 // CHECK-NEXT: call void [[REG1]]() // CHECK-NEXT: [[REG2:%[0-9]+]] = ptrtoint void ()* [[REG1]] to i64 -// CHECK-NEXT: call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({ i32, i32, i64, i8*, i64*, i8*, i8*, [1 x i16] }* @__profd_main to i8*), i32 0) +// CHECK-NEXT: call void @__llvm_profile_instrument_target(i64 [[REG2]], i8* bitcast ({{.*}}* @__profd_main to i8*), i32 0) foo(); return 0; } diff --git a/test/Profile/c-linkage-available_externally.c b/test/Profile/c-linkage-available_externally.c index 8585bf8425..61a258636b 100644 --- a/test/Profile/c-linkage-available_externally.c +++ b/test/Profile/c-linkage-available_externally.c @@ -1,11 +1,9 @@ -// Make sure instrementation data from available_externally functions doesn't -// get thrown out. +// Make sure instrumentation data from available_externally functions doesn't +// get thrown out and are emitted with the expected linkage. // RUN: %clang_cc1 -O2 -triple x86_64-apple-macosx10.9 -main-file-name c-linkage-available_externally.c %s -o - -emit-llvm -fprofile-instr-generate | FileCheck %s -// CHECK: @__profn_foo = linkonce_odr hidden constant [3 x i8] c"foo", section "__DATA,__llvm_prf_names", align 1 - // CHECK: @__profc_foo = linkonce_odr hidden global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8 -// CHECK: @__profd_foo = linkonce_odr hidden global { i32, i32, i64, i8*, i64*, i8*, i8*, [1 x i16] } { i32 3, i32 1, i64 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i32 0, i32 0), i8* null, i8* null, [1 x i16] zeroinitializer }, section "__DATA,__llvm_prf_data", align 8 +// CHECK: @__profd_foo = linkonce_odr hidden global {{.*}} i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i32 0, i32 0){{.*}}, section "__DATA,__llvm_prf_data", align 8 inline int foo(void) { return 1; } int main(void) { diff --git a/test/Profile/c-linkage.c b/test/Profile/c-linkage.c index e6fbda9c28..c82dcabb60 100644 --- a/test/Profile/c-linkage.c +++ b/test/Profile/c-linkage.c @@ -1,10 +1,14 @@ -// Check that the profiling names we create have the linkage we expect +// Check that the profiling counters and data we create have the linkage we expect // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-linkage.c %s -o - -emit-llvm -fprofile-instr-generate | FileCheck %s -// CHECK: @__profn_foo = private constant [3 x i8] c"foo" -// CHECK: @__profn_foo_weak = weak hidden constant [8 x i8] c"foo_weak" -// CHECK: @__profn_main = private constant [4 x i8] c"main" -// CHECK: @__profn_c_linkage.c_foo_internal = private constant [24 x i8] c"c-linkage.c:foo_internal" +// CHECK: @__profc_foo = private global +// CHECK: @__profd_foo = private global +// CHECK: @__profc_foo_weak = weak hidden global +// CHECK: @__profd_foo_weak = weak hidden global +// CHECK: @__profc_main = private global +// CHECK: @__profd_main = private global +// CHECK: @__profc_c_linkage.c_foo_internal = private global +// CHECK: @__profd_c_linkage.c_foo_internal = private global void foo(void) { } diff --git a/test/Profile/cxx-linkage.cpp b/test/Profile/cxx-linkage.cpp index 701a880281..55934037ba 100644 --- a/test/Profile/cxx-linkage.cpp +++ b/test/Profile/cxx-linkage.cpp @@ -1,9 +1,13 @@ // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -emit-llvm -main-file-name cxx-linkage.cpp %s -o - -fprofile-instr-generate | FileCheck %s -// CHECK: @__profn__Z3foov = private constant [7 x i8] c"_Z3foov" -// CHECK: @__profn__Z8foo_weakv = weak hidden constant [12 x i8] c"_Z8foo_weakv" -// CHECK: @__profn_main = private constant [4 x i8] c"main" -// CHECK: @__profn__Z10foo_inlinev = linkonce_odr hidden constant [15 x i8] c"_Z10foo_inlinev" +// CHECK: @__profc__Z3foov = private global +// CHECK: @__profd__Z3foov = private global +// CHECK: @__profc__Z8foo_weakv = weak hidden global +// CHECK: @__profd__Z8foo_weakv = weak hidden global +// CHECK: @__profc_main = private global +// CHECK: @__profd_main = private global +// CHECK: @__profc__Z10foo_inlinev = linkonce_odr hidden global +// CHECK: @__profd__Z10foo_inlinev = linkonce_odr hidden global void foo(void) { }