[test-suite] r353591 - [test-suite] Add cmake option to use IR PGO (TEST_SUITE_USE_IR_PGO)
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 8 16:54:55 PST 2019
Author: vedantk
Date: Fri Feb 8 16:54:55 2019
New Revision: 353591
URL: http://llvm.org/viewvc/llvm-project?rev=353591&view=rev
Log:
[test-suite] Add cmake option to use IR PGO (TEST_SUITE_USE_IR_PGO)
This allows building programs in the test suite with LLVM's IR PGO
feature. Support for re-building programs with the collected profdata is
already present.
Differential Revision: https://reviews.llvm.org/D57985
Modified:
test-suite/trunk/CMakeLists.txt
test-suite/trunk/litsupport/README.md
Modified: test-suite/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/CMakeLists.txt?rev=353591&r1=353590&r2=353591&view=diff
==============================================================================
--- test-suite/trunk/CMakeLists.txt (original)
+++ test-suite/trunk/CMakeLists.txt Fri Feb 8 16:54:55 2019
@@ -94,6 +94,8 @@ Make sure it is in your path or set TEST
endif()
endif()
+option(TEST_SUITE_USE_IR_PGO
+ "Use IR PGO instrumentation (requires TEST_SUITE_PROFILE_GENERATE)" OFF)
# Enable profile generate mode in lit. Note that this does not automatically
# add something like -fprofile-instr-generate to the compiler flags.
@@ -109,9 +111,15 @@ Make sure it is in your path or set TEST
endif()
set(TEST_SUITE_PROFILE_GENERATE "True")
- list(APPEND CFLAGS -fprofile-instr-generate)
- list(APPEND CXXFLAGS -fprofile-instr-generate)
- list(APPEND LDFLAGS -fprofile-instr-generate)
+
+ set(profile_instrumentation_flags -fprofile-instr-generate)
+ if(TEST_SUITE_USE_IR_PGO)
+ set(profile_instrumentation_flags -fprofile-generate)
+ endif()
+
+ list(APPEND CFLAGS ${profile_instrumentation_flags})
+ list(APPEND CXXFLAGS ${profile_instrumentation_flags})
+ list(APPEND LDFLAGS ${profile_instrumentation_flags})
else()
set(TEST_SUITE_PROFILE_GENERATE "False")
endif()
Modified: test-suite/trunk/litsupport/README.md
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/litsupport/README.md?rev=353591&r1=353590&r2=353591&view=diff
==============================================================================
--- test-suite/trunk/litsupport/README.md (original)
+++ test-suite/trunk/litsupport/README.md Fri Feb 8 16:54:55 2019
@@ -70,7 +70,8 @@ code; typical examples are:
ssh to run benchmarks on a remote device (assuming shared file systems).
- `cmake -DTEST_SUITE_PROFILE_GENERATE` compiles benchmark with
`-fprofile-instr-generate` and enables the `profilegen` module that runs
- `llvm-profdata` after running the benchmarks.
+ `llvm-profdata` after running the benchmarks. To use LLVM IR PGO instead of
+ the clang frontend's PGO feature, set `-DTEST_SUITE_USE_IR_PGO=On`.
Available modules are found in the `litsupport/modules` directory.
More information about the llvm-commits
mailing list