From 89e314dafac217ca5d63877a4ec3f0c8176e5f1e Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Tue, 11 Mar 2014 04:37:49 +0000 Subject: [PATCH] test: Give instrumentation based profiling tests their own directory These tests are logically related, but they're spread about several different CodeGen directories. Consolidate them in one place to make them easier to manage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203541 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGenObjC/Inputs/instr-profile.profdata | 11 ----------- .../Inputs/c-attributes.profdata} | 0 .../Inputs/c-general.profdata} | 2 +- .../Inputs/cxx-class.profdata} | 0 .../Inputs/cxx-throws.profdata} | 0 test/Profile/Inputs/objc-general.profdata | 10 ++++++++++ test/Profile/README | 8 ++++++++ .../instr-attribute.c => Profile/c-attributes.c} | 2 +- .../instr-profile.c => Profile/c-general.c} | 13 ++++--------- .../cxx-class.cpp} | 9 ++------- .../cxx-throws.cpp} | 10 +++------- .../instr-profile.m => Profile/objc-general.m} | 10 +++------- 12 files changed, 32 insertions(+), 43 deletions(-) delete mode 100644 test/CodeGenObjC/Inputs/instr-profile.profdata rename test/{CodeGen/Inputs/instr-attribute.profdata => Profile/Inputs/c-attributes.profdata} (100%) rename test/{CodeGen/Inputs/instr-profile.profdata => Profile/Inputs/c-general.profdata} (93%) rename test/{CodeGenCXX/Inputs/instr-profile-class.profdata => Profile/Inputs/cxx-class.profdata} (100%) rename test/{CodeGenCXX/Inputs/instr-profile-throws.profdata => Profile/Inputs/cxx-throws.profdata} (100%) create mode 100644 test/Profile/Inputs/objc-general.profdata create mode 100644 test/Profile/README rename test/{CodeGen/instr-attribute.c => Profile/c-attributes.c} (93%) rename test/{CodeGen/instr-profile.c => Profile/c-general.c} (96%) rename test/{CodeGenCXX/instr-profile-class.cpp => Profile/cxx-class.cpp} (85%) rename test/{CodeGenCXX/instr-profile-throws.cpp => Profile/cxx-throws.cpp} (82%) rename test/{CodeGenObjC/instr-profile.m => Profile/objc-general.m} (76%) diff --git a/test/CodeGenObjC/Inputs/instr-profile.profdata b/test/CodeGenObjC/Inputs/instr-profile.profdata deleted file mode 100644 index 0fe046e579..0000000000 --- a/test/CodeGenObjC/Inputs/instr-profile.profdata +++ /dev/null @@ -1,11 +0,0 @@ -instr-profile.m:__13+[A foreach:]_block_invoke 2 -2 -1 - -instr-profile.m:+[A foreach:] 2 -1 -2 - -main 1 -1 - diff --git a/test/CodeGen/Inputs/instr-attribute.profdata b/test/Profile/Inputs/c-attributes.profdata similarity index 100% rename from test/CodeGen/Inputs/instr-attribute.profdata rename to test/Profile/Inputs/c-attributes.profdata diff --git a/test/CodeGen/Inputs/instr-profile.profdata b/test/Profile/Inputs/c-general.profdata similarity index 93% rename from test/CodeGen/Inputs/instr-profile.profdata rename to test/Profile/Inputs/c-general.profdata index f6337d2332..e87f78e6b5 100644 --- a/test/CodeGen/Inputs/instr-profile.profdata +++ b/test/Profile/Inputs/c-general.profdata @@ -132,7 +132,7 @@ no_usable_data 5 main 1 1 -instr-profile.c:static_func 2 +c-general.c:static_func 2 1 10 diff --git a/test/CodeGenCXX/Inputs/instr-profile-class.profdata b/test/Profile/Inputs/cxx-class.profdata similarity index 100% rename from test/CodeGenCXX/Inputs/instr-profile-class.profdata rename to test/Profile/Inputs/cxx-class.profdata diff --git a/test/CodeGenCXX/Inputs/instr-profile-throws.profdata b/test/Profile/Inputs/cxx-throws.profdata similarity index 100% rename from test/CodeGenCXX/Inputs/instr-profile-throws.profdata rename to test/Profile/Inputs/cxx-throws.profdata diff --git a/test/Profile/Inputs/objc-general.profdata b/test/Profile/Inputs/objc-general.profdata new file mode 100644 index 0000000000..da421583b8 --- /dev/null +++ b/test/Profile/Inputs/objc-general.profdata @@ -0,0 +1,10 @@ +objc-general.m:__13+[A foreach:]_block_invoke 2 +2 +1 + +objc-general.m:+[A foreach:] 2 +1 +2 + +main 1 +1 diff --git a/test/Profile/README b/test/Profile/README new file mode 100644 index 0000000000..8cf13c062f --- /dev/null +++ b/test/Profile/README @@ -0,0 +1,8 @@ +These are tests for instrumentation based profiling. This specifically +means the -fprofile-instr-generate and -fprofile-instr-use driver flags. + +Tests in this directory should test both the generation of profile +data, and the use of that same data. As such, the input source file +should include a main function such that building with -use and +running the resulting program would generate the input data that is +consumed in the -generate case. diff --git a/test/CodeGen/instr-attribute.c b/test/Profile/c-attributes.c similarity index 93% rename from test/CodeGen/instr-attribute.c rename to test/Profile/c-attributes.c index b239980754..81809551fd 100644 --- a/test/CodeGen/instr-attribute.c +++ b/test/Profile/c-attributes.c @@ -1,6 +1,6 @@ // Test that instrumentation based profiling sets function attributes correctly. -// RUN: %clang %s -o - -mllvm -disable-llvm-optzns -emit-llvm -S -fprofile-instr-use=%S/Inputs/instr-attribute.profdata | FileCheck %s +// RUN: %clang %s -o - -mllvm -disable-llvm-optzns -emit-llvm -S -fprofile-instr-use=%S/Inputs/c-attributes.profdata | FileCheck %s extern int atoi(const char *); diff --git a/test/CodeGen/instr-profile.c b/test/Profile/c-general.c similarity index 96% rename from test/CodeGen/instr-profile.c rename to test/Profile/c-general.c index 05656ab508..43ebf51182 100644 --- a/test/CodeGen/instr-profile.c +++ b/test/Profile/c-general.c @@ -1,12 +1,7 @@ -// Test that instrumentation based profiling feeds branch prediction -// correctly. This tests both generation of profile data and use of the same, -// and the input file for the -fprofile-instr-use case is expected to be result -// of running the program generated by the -fprofile-instr-generate case -// (excepting no_usable_data). As such, main() should call every function in -// this test. - -// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name instr-profile.c %s -o - -emit-llvm -fprofile-instr-generate | FileCheck -check-prefix=PGOGEN %s -// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name instr-profile.c %s -o - -emit-llvm -fprofile-instr-use=%S/Inputs/instr-profile.profdata | FileCheck -check-prefix=PGOUSE %s +// Test instrumentation of general constructs in C. + +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-general.c %s -o - -emit-llvm -fprofile-instr-generate | FileCheck -check-prefix=PGOGEN %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-general.c %s -o - -emit-llvm -fprofile-instr-use=%S/Inputs/c-general.profdata | FileCheck -check-prefix=PGOUSE %s // PGOGEN: @[[SLC:__llvm_pgo_ctr[0-9]*]] = private global [4 x i64] zeroinitializer // PGOGEN: @[[IFC:__llvm_pgo_ctr[0-9]*]] = private global [11 x i64] zeroinitializer diff --git a/test/CodeGenCXX/instr-profile-class.cpp b/test/Profile/cxx-class.cpp similarity index 85% rename from test/CodeGenCXX/instr-profile-class.cpp rename to test/Profile/cxx-class.cpp index f23aac6f7c..5934a0adb7 100644 --- a/test/CodeGenCXX/instr-profile-class.cpp +++ b/test/Profile/cxx-class.cpp @@ -1,9 +1,4 @@ -// Test that instrumentation based profiling feeds branch prediction -// correctly. This tests both generation of profile data and use of the same, -// and the input file for the -fprofile-instr-use case is expected to be result -// of running the program generated by the -fprofile-instr-generate case -// (excepting no_usable_data). As such, main() should call every function in -// this test. +// Tests for instrumentation of C++ methods, constructors, and destructors. // RUN: %clang %s -o - -emit-llvm -S -fprofile-instr-generate -fno-exceptions -target %itanium_abi_triple > %tgen // RUN: FileCheck --input-file=%tgen -check-prefix=CTRGEN %s @@ -11,7 +6,7 @@ // RUN: FileCheck --input-file=%tgen -check-prefix=MTHGEN %s // RUN: FileCheck --input-file=%tgen -check-prefix=WRPGEN %s -// RUN: %clang %s -o - -emit-llvm -S -fprofile-instr-use=%S/Inputs/instr-profile-class.profdata -fno-exceptions -target %itanium_abi_triple > %tuse +// RUN: %clang %s -o - -emit-llvm -S -fprofile-instr-use=%S/Inputs/cxx-class.profdata -fno-exceptions -target %itanium_abi_triple > %tuse // RUN: FileCheck --input-file=%tuse -check-prefix=CTRUSE %s // RUN: FileCheck --input-file=%tuse -check-prefix=DTRUSE %s // RUN: FileCheck --input-file=%tuse -check-prefix=MTHUSE %s diff --git a/test/CodeGenCXX/instr-profile-throws.cpp b/test/Profile/cxx-throws.cpp similarity index 82% rename from test/CodeGenCXX/instr-profile-throws.cpp rename to test/Profile/cxx-throws.cpp index d25827c5e0..0a8ebf1558 100644 --- a/test/CodeGenCXX/instr-profile-throws.cpp +++ b/test/Profile/cxx-throws.cpp @@ -1,8 +1,4 @@ -// Test that instrumentation based profiling feeds branch prediction -// correctly. This tests both generation of profile data and use of the same, -// and the input file for the -fprofile-instr-use case is expected to be result -// of running the program generated by the -fprofile-instr-generate case. As -// such, main() should call every function in this test. +// Test instrumentation of C++ exception handling constructs. // FIXME: Don't seek bb labels, like "if.else" // REQUIRES: asserts @@ -10,8 +6,8 @@ // RUN: %clangxx %s -o - -emit-llvm -S -fprofile-instr-generate -target %itanium_abi_triple | FileCheck -check-prefix=PGOGEN %s // RUN: %clangxx %s -o - -emit-llvm -S -fprofile-instr-generate -target %itanium_abi_triple | FileCheck -check-prefix=PGOGEN-EXC %s -// RUN: %clang %s -o - -emit-llvm -S -fprofile-instr-use=%S/Inputs/instr-profile-throws.profdata -target %itanium_abi_triple | FileCheck -check-prefix=PGOUSE %s -// RUN: %clang %s -o - -emit-llvm -S -fprofile-instr-use=%S/Inputs/instr-profile-throws.profdata -target %itanium_abi_triple | FileCheck -check-prefix=PGOUSE-EXC %s +// RUN: %clang %s -o - -emit-llvm -S -fprofile-instr-use=%S/Inputs/cxx-throws.profdata -target %itanium_abi_triple | FileCheck -check-prefix=PGOUSE %s +// RUN: %clang %s -o - -emit-llvm -S -fprofile-instr-use=%S/Inputs/cxx-throws.profdata -target %itanium_abi_triple | FileCheck -check-prefix=PGOUSE-EXC %s // PGOGEN: @[[THC:__llvm_pgo_ctr[0-9]*]] = private global [9 x i64] zeroinitializer // PGOGEN-EXC: @[[THC:__llvm_pgo_ctr[0-9]*]] = private global [9 x i64] zeroinitializer diff --git a/test/CodeGenObjC/instr-profile.m b/test/Profile/objc-general.m similarity index 76% rename from test/CodeGenObjC/instr-profile.m rename to test/Profile/objc-general.m index c1bb50574d..b5f2673302 100644 --- a/test/CodeGenObjC/instr-profile.m +++ b/test/Profile/objc-general.m @@ -1,11 +1,7 @@ -// Test that instrumentation based profiling feeds branch prediction -// correctly. This tests both generation of profile data and use of the same, -// and the input file for the -fprofile-instr-use case is expected to be result -// of running the program generated by the -fprofile-instr-generate case. As -// such, main() should call every function in this test. +// Test instrumentation of general constructs in objective C. -// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name instr-profile.m %s -o - -emit-llvm -fblocks -fprofile-instr-generate | FileCheck -check-prefix=PGOGEN %s -// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name instr-profile.m %s -o - -emit-llvm -fblocks -fprofile-instr-use=%S/Inputs/instr-profile.profdata | FileCheck -check-prefix=PGOUSE %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name objc-general.m %s -o - -emit-llvm -fblocks -fprofile-instr-generate | FileCheck -check-prefix=PGOGEN %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name objc-general.m %s -o - -emit-llvm -fblocks -fprofile-instr-use=%S/Inputs/objc-general.profdata | FileCheck -check-prefix=PGOUSE %s #ifdef HAVE_FOUNDATION -- 2.40.0