From: Justin Bogner Date: Thu, 17 Apr 2014 22:49:06 +0000 (+0000) Subject: test: Use llvm-profdata merge in Profile tests X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dea85f9d241126f844cc46d4e91e7755c8e1851c;p=clang test: Use llvm-profdata merge in Profile tests In preparation for using a binary format for instrumentation based profiling, explicitly treat the test inputs as text and transform them before running. This will allow us to leave the checked in files in human readable format once the instrumentation format is binary. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206509 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 209154003a..970c7b96b3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -39,7 +39,7 @@ set(CLANG_TEST_PARAMS if( NOT CLANG_BUILT_STANDALONE ) list(APPEND CLANG_TEST_DEPS llvm-config - llc opt FileCheck count not llvm-symbolizer + llc opt FileCheck count not llvm-symbolizer llvm-profdata ) endif() diff --git a/test/Profile/Inputs/c-attributes.profdata b/test/Profile/Inputs/c-attributes.proftext similarity index 100% rename from test/Profile/Inputs/c-attributes.profdata rename to test/Profile/Inputs/c-attributes.proftext diff --git a/test/Profile/Inputs/c-captured.profdata b/test/Profile/Inputs/c-captured.proftext similarity index 100% rename from test/Profile/Inputs/c-captured.profdata rename to test/Profile/Inputs/c-captured.proftext diff --git a/test/Profile/Inputs/c-counter-overflows.profdata b/test/Profile/Inputs/c-counter-overflows.proftext similarity index 100% rename from test/Profile/Inputs/c-counter-overflows.profdata rename to test/Profile/Inputs/c-counter-overflows.proftext diff --git a/test/Profile/Inputs/c-general.profdata b/test/Profile/Inputs/c-general.proftext similarity index 100% rename from test/Profile/Inputs/c-general.profdata rename to test/Profile/Inputs/c-general.proftext diff --git a/test/Profile/Inputs/c-outdated-data.profdata b/test/Profile/Inputs/c-outdated-data.proftext similarity index 100% rename from test/Profile/Inputs/c-outdated-data.profdata rename to test/Profile/Inputs/c-outdated-data.proftext diff --git a/test/Profile/Inputs/c-unprofiled-blocks.profdata b/test/Profile/Inputs/c-unprofiled-blocks.proftext similarity index 100% rename from test/Profile/Inputs/c-unprofiled-blocks.profdata rename to test/Profile/Inputs/c-unprofiled-blocks.proftext diff --git a/test/Profile/Inputs/cxx-class.profdata b/test/Profile/Inputs/cxx-class.proftext similarity index 100% rename from test/Profile/Inputs/cxx-class.profdata rename to test/Profile/Inputs/cxx-class.proftext diff --git a/test/Profile/Inputs/cxx-lambda.profdata b/test/Profile/Inputs/cxx-lambda.proftext similarity index 100% rename from test/Profile/Inputs/cxx-lambda.profdata rename to test/Profile/Inputs/cxx-lambda.proftext diff --git a/test/Profile/Inputs/cxx-templates.profdata b/test/Profile/Inputs/cxx-templates.proftext similarity index 100% rename from test/Profile/Inputs/cxx-templates.profdata rename to test/Profile/Inputs/cxx-templates.proftext diff --git a/test/Profile/Inputs/cxx-throws.profdata b/test/Profile/Inputs/cxx-throws.proftext similarity index 100% rename from test/Profile/Inputs/cxx-throws.profdata rename to test/Profile/Inputs/cxx-throws.proftext diff --git a/test/Profile/Inputs/objc-general.profdata b/test/Profile/Inputs/objc-general.proftext similarity index 100% rename from test/Profile/Inputs/objc-general.profdata rename to test/Profile/Inputs/objc-general.proftext diff --git a/test/Profile/c-attributes.c b/test/Profile/c-attributes.c index 81809551fd..2dcc180624 100644 --- a/test/Profile/c-attributes.c +++ b/test/Profile/c-attributes.c @@ -1,6 +1,7 @@ // 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/c-attributes.profdata | FileCheck %s +// RUN: llvm-profdata merge %S/Inputs/c-attributes.proftext -o %t.profdata +// RUN: %clang %s -o - -mllvm -disable-llvm-optzns -emit-llvm -S -fprofile-instr-use=%t.profdata | FileCheck %s extern int atoi(const char *); diff --git a/test/Profile/c-captured.c b/test/Profile/c-captured.c index a2678ec628..47b1bbc7b7 100644 --- a/test/Profile/c-captured.c +++ b/test/Profile/c-captured.c @@ -1,5 +1,7 @@ // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-captured.c %s -o - -emit-llvm -fprofile-instr-generate | FileCheck -check-prefix=PGOGEN -check-prefix=PGOALL %s -// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-captured.c %s -o - -emit-llvm -fprofile-instr-use=%S/Inputs/c-captured.profdata | FileCheck -check-prefix=PGOUSE -check-prefix=PGOALL %s + +// RUN: llvm-profdata merge %S/Inputs/c-captured.proftext -o %t.profdata +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-captured.c %s -o - -emit-llvm -fprofile-instr-use=%t.profdata | FileCheck -check-prefix=PGOUSE -check-prefix=PGOALL %s // PGOGEN: @[[DCC:__llvm_profile_counters_debug_captured]] = global [3 x i64] zeroinitializer // PGOGEN: @[[CSC:__llvm_profile_counters___captured_stmt]] = internal global [2 x i64] zeroinitializer diff --git a/test/Profile/c-counter-overflows.c b/test/Profile/c-counter-overflows.c index 7cbe9bba86..f6f8f73fd9 100644 --- a/test/Profile/c-counter-overflows.c +++ b/test/Profile/c-counter-overflows.c @@ -1,7 +1,8 @@ // Test that big branch weights get scaled down to 32-bits, rather than just // truncated. -// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-counter-overflows.c %s -o - -emit-llvm -fprofile-instr-use=%S/Inputs/c-counter-overflows.profdata | FileCheck %s +// RUN: llvm-profdata merge %S/Inputs/c-counter-overflows.proftext -o %t.profdata +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-counter-overflows.c %s -o - -emit-llvm -fprofile-instr-use=%t.profdata | FileCheck %s typedef unsigned long long uint64_t; diff --git a/test/Profile/c-general.c b/test/Profile/c-general.c index 1359d287af..21ba005894 100644 --- a/test/Profile/c-general.c +++ b/test/Profile/c-general.c @@ -1,7 +1,9 @@ // 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 + +// RUN: llvm-profdata merge %S/Inputs/c-general.proftext -o %t.profdata +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-general.c %s -o - -emit-llvm -fprofile-instr-use=%t.profdata | FileCheck -check-prefix=PGOUSE %s // PGOGEN: @[[SLC:__llvm_profile_counters_simple_loops]] = global [4 x i64] zeroinitializer // PGOGEN: @[[IFC:__llvm_profile_counters_conditionals]] = global [11 x i64] zeroinitializer diff --git a/test/Profile/c-outdated-data.c b/test/Profile/c-outdated-data.c index c241005b70..d0503acdb6 100644 --- a/test/Profile/c-outdated-data.c +++ b/test/Profile/c-outdated-data.c @@ -3,7 +3,8 @@ // FIXME: It would be nice to use -verify here instead of FileCheck, but -verify // doesn't play well with warnings that have no line number. -// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-outdated-data.c %s -o /dev/null -emit-llvm -fprofile-instr-use=%S/Inputs/c-outdated-data.profdata -Wprofile-instr-dropped 2>&1 | FileCheck %s +// RUN: llvm-profdata merge %S/Inputs/c-outdated-data.proftext -o %t.profdata +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-outdated-data.c %s -o /dev/null -emit-llvm -fprofile-instr-use=%t.profdata -Wprofile-instr-dropped 2>&1 | FileCheck %s // CHECK: warning: profile data may be out of date: of 3 functions, 1 has no data and 1 has mismatched data that will be ignored void no_usable_data() { diff --git a/test/Profile/c-unprofiled-blocks.c b/test/Profile/c-unprofiled-blocks.c index 1f75a0da47..58bef9e296 100644 --- a/test/Profile/c-unprofiled-blocks.c +++ b/test/Profile/c-unprofiled-blocks.c @@ -1,7 +1,8 @@ // Blocks that we have no profile data for (ie, it was never reached in training // runs) shouldn't have any branch weight metadata added. -// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-unprofiled-blocks.c %s -o - -emit-llvm -fprofile-instr-use=%S/Inputs/c-unprofiled-blocks.profdata | FileCheck -check-prefix=PGOUSE %s +// RUN: llvm-profdata merge %S/Inputs/c-unprofiled-blocks.proftext -o %t.profdata +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-unprofiled-blocks.c %s -o - -emit-llvm -fprofile-instr-use=%t.profdata | FileCheck -check-prefix=PGOUSE %s // PGOUSE-LABEL: @never_called(i32 %i) int never_called(int i) { diff --git a/test/Profile/cxx-class.cpp b/test/Profile/cxx-class.cpp index 7cbbc09610..1a0c84bdcc 100644 --- a/test/Profile/cxx-class.cpp +++ b/test/Profile/cxx-class.cpp @@ -6,7 +6,8 @@ // 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/cxx-class.profdata -fno-exceptions -target %itanium_abi_triple > %tuse +// RUN: llvm-profdata merge %S/Inputs/cxx-class.proftext -o %t.profdata +// RUN: %clang %s -o - -emit-llvm -S -fprofile-instr-use=%t.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/Profile/cxx-lambda.cpp b/test/Profile/cxx-lambda.cpp index fedb1019e7..923a432464 100644 --- a/test/Profile/cxx-lambda.cpp +++ b/test/Profile/cxx-lambda.cpp @@ -4,7 +4,8 @@ // RUN: FileCheck --input-file=%tgen -check-prefix=PGOGEN %s // RUN: FileCheck --input-file=%tgen -check-prefix=LMBGEN %s -// RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-lambda.cpp -std=c++11 -o - -emit-llvm -fprofile-instr-use=%S/Inputs/cxx-lambda.profdata > %tuse +// RUN: llvm-profdata merge %S/Inputs/cxx-lambda.proftext -o %t.profdata +// RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-lambda.cpp -std=c++11 -o - -emit-llvm -fprofile-instr-use=%t.profdata > %tuse // RUN: FileCheck --input-file=%tuse -check-prefix=PGOUSE %s // RUN: FileCheck --input-file=%tuse -check-prefix=LMBUSE %s diff --git a/test/Profile/cxx-templates.cpp b/test/Profile/cxx-templates.cpp index d59f7b97c6..5f99b999b8 100644 --- a/test/Profile/cxx-templates.cpp +++ b/test/Profile/cxx-templates.cpp @@ -5,7 +5,8 @@ // RUN: FileCheck --input-file=%tgen -check-prefix=T0GEN -check-prefix=ALL %s // RUN: FileCheck --input-file=%tgen -check-prefix=T100GEN -check-prefix=ALL %s -// RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-templates.cpp -std=c++11 -o - -emit-llvm -fprofile-instr-use=%S/Inputs/cxx-templates.profdata > %tuse +// RUN: llvm-profdata merge %S/Inputs/cxx-templates.proftext -o %t.profdata +// RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-templates.cpp -std=c++11 -o - -emit-llvm -fprofile-instr-use=%t.profdata > %tuse // RUN: FileCheck --input-file=%tuse -check-prefix=T0USE -check-prefix=ALL %s // RUN: FileCheck --input-file=%tuse -check-prefix=T100USE -check-prefix=ALL %s diff --git a/test/Profile/cxx-throws.cpp b/test/Profile/cxx-throws.cpp index cdcf53a14b..e5017bc22b 100644 --- a/test/Profile/cxx-throws.cpp +++ b/test/Profile/cxx-throws.cpp @@ -6,8 +6,9 @@ // 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/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 +// RUN: llvm-profdata merge %S/Inputs/cxx-throws.proftext -o %t.profdata +// RUN: %clang %s -o - -emit-llvm -S -fprofile-instr-use=%t.profdata -target %itanium_abi_triple | FileCheck -check-prefix=PGOUSE %s +// RUN: %clang %s -o - -emit-llvm -S -fprofile-instr-use=%t.profdata -target %itanium_abi_triple | FileCheck -check-prefix=PGOUSE-EXC %s // PGOGEN: @[[THC:__llvm_profile_counters__Z6throwsv]] = global [9 x i64] zeroinitializer // PGOGEN-EXC: @[[THC:__llvm_profile_counters__Z6throwsv]] = global [9 x i64] zeroinitializer diff --git a/test/Profile/objc-general.m b/test/Profile/objc-general.m index 568e5e4182..dc746189a8 100644 --- a/test/Profile/objc-general.m +++ b/test/Profile/objc-general.m @@ -1,7 +1,9 @@ // Test instrumentation of general constructs in objective C. // 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 + +// RUN: llvm-profdata merge %S/Inputs/objc-general.proftext -o %t.profdata +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name objc-general.m %s -o - -emit-llvm -fblocks -fprofile-instr-use=%t.profdata | FileCheck -check-prefix=PGOUSE %s #ifdef HAVE_FOUNDATION