-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[llvm-driver] Remove llvm-profdata from the driver #162191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
llvm-profdata uses cl tool for command line parsing which declares global options which can clash in a multicall driver build. Removing llvm-profdata from the driver.
@llvm/pr-subscribers-pgo Author: Prabhu Rajasekaran (Prabhuk) Changesllvm-profdata uses cl tool for command line parsing which declares Full diff: https://github.com/llvm/llvm-project/pull/162191.diff 2 Files Affected:
diff --git a/llvm/tools/llvm-profdata/CMakeLists.txt b/llvm/tools/llvm-profdata/CMakeLists.txt
index 165be9a2ea31b..e5aa858f3d39c 100644
--- a/llvm/tools/llvm-profdata/CMakeLists.txt
+++ b/llvm/tools/llvm-profdata/CMakeLists.txt
@@ -10,9 +10,6 @@ add_llvm_tool(llvm-profdata
DEPENDS
intrinsics_gen
- GENERATE_DRIVER
)
-if(NOT LLVM_TOOL_LLVM_DRIVER_BUILD)
- target_link_libraries(llvm-profdata PRIVATE LLVMDebuginfod)
-endif()
+target_link_libraries(llvm-profdata PRIVATE LLVMDebuginfod)
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index d658ea99ab1b9..15ddb05f953ee 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -3464,10 +3464,7 @@ static int order_main() {
return 0;
}
-int llvm_profdata_main(int argc, char **argvNonConst,
- const llvm::ToolContext &) {
- const char **argv = const_cast<const char **>(argvNonConst);
-
+int main(int argc, const char *argv[]) {
StringRef ProgName(sys::path::filename(argv[0]));
if (argc < 2) {
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW looks like it was 493e240 moved the inline cl::
objects to global scope.
Can this be fixed by making the cl::opt file scoped? @mingmingl-llvm fyi |
We plan to convert |
Would you mind giving a small example of this? IIUC command option names are registered such that the same option string can only show up once under a namespace, and |
Example -- you can build the llvm-profdata as part of the multilib driver (LLVM_TOOL_LLVM_DRIVER_BUILD) to observe the problem readily. llvm-profdata --help in a multicall build will print the help options which are unrelated to llvm-profdata. Output from my desktop is pasted below. The reason is that cl::opt registers the options globally. So the multicall binary will see all cl::opt options registered from all tools resulting in problems such as this --help example. This is a known limitation with cl::opt tool. We are trying to port all tools that need to be part of multicall driver to use llvm::opt::OptTable. OptTable originally did not have support for Subcommands which prevented is from using it in llvm-profdata. But we now support SubCommands in OptTable(#155026). Hopefully we can port llvm-profdata to OptTable and then reenable multicall driver mode for it soon. Any help in porting this tool to OptTable will be much appreciated.
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/116/builds/19344 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/186/builds/12978 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/17113 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/169/builds/15702 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/166/builds/2661 Here is the relevant piece of the build log for the reference
|
llvm-profdata uses cl tool for command line parsing which declares
global options which can clash in a multicall driver build. Removing
llvm-profdata from the driver.