From 3106d9a1227e3271e12e44394e83132dc55b0f56 Mon Sep 17 00:00:00 2001 From: Xinliang David Li Date: Thu, 28 Jan 2016 18:25:53 +0000 Subject: [PATCH] [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. llvm-svn: 259067 --- clang/test/Profile/c-indirect-call.c | 2 +- clang/test/Profile/c-linkage-available_externally.c | 8 +++----- clang/test/Profile/c-linkage.c | 14 +++++++++----- clang/test/Profile/cxx-linkage.cpp | 12 ++++++++---- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/clang/test/Profile/c-indirect-call.c b/clang/test/Profile/c-indirect-call.c index 0d8f3ba..d73d09a 100644 --- a/clang/test/Profile/c-indirect-call.c +++ b/clang/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/clang/test/Profile/c-linkage-available_externally.c b/clang/test/Profile/c-linkage-available_externally.c index 8585bf8..61a2586 100644 --- a/clang/test/Profile/c-linkage-available_externally.c +++ b/clang/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/clang/test/Profile/c-linkage.c b/clang/test/Profile/c-linkage.c index e6fbda9..c82dcabb 100644 --- a/clang/test/Profile/c-linkage.c +++ b/clang/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/clang/test/Profile/cxx-linkage.cpp b/clang/test/Profile/cxx-linkage.cpp index 701a880..5593403 100644 --- a/clang/test/Profile/cxx-linkage.cpp +++ b/clang/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) { } -- 2.7.4