Repository navigation
[llvm-driver] Remove llvm-profdata from the driver - #162191
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) {
|
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 |
|
What's the plan here for fixing the https://lab.llvm.org/buildbot/#/builders/166 build bot? |
These builders are green now. The original problem in builds 2661 seem unrelated to this change on first look. |
Before llvm-profdata participated in llvm-driver it directly called InitLLVM, which takes care of wildcard argument expansion for tools on Windows. When llvm-driver support was added to llvm-profdata this InitLLVM call was effectively moved into the common llvm-driver wrapper mechanism. More recently, in #162191, llvm-driver support was temporarily backed out of llvm-profdata due to an issue with `cl::opt` handling. This change reintroduces the direct call to InitLLVM in order to restore wildcard expansion and also adds a test for the wildcard expansion on Windows.
Before llvm-profdata participated in llvm-driver it directly called InitLLVM, which takes care of wildcard argument expansion for tools on Windows. When llvm-driver support was added to llvm-profdata this InitLLVM call was effectively moved into the common llvm-driver wrapper mechanism. More recently, in llvm#162191, llvm-driver support was temporarily backed out of llvm-profdata due to an issue with `cl::opt` handling. This change reintroduces the direct call to InitLLVM in order to restore wildcard expansion and also adds a test for the wildcard expansion on Windows.
Before llvm-profdata participated in llvm-driver it directly called InitLLVM, which takes care of wildcard argument expansion for tools on Windows. When llvm-driver support was added to llvm-profdata this InitLLVM call was effectively moved into the common llvm-driver wrapper mechanism. More recently, in llvm#162191, llvm-driver support was temporarily backed out of llvm-profdata due to an issue with `cl::opt` handling. This change reintroduces the direct call to InitLLVM in order to restore wildcard expansion and also adds a test for the wildcard expansion on Windows.
Before llvm-profdata participated in llvm-driver it directly called InitLLVM, which takes care of wildcard argument expansion for tools on Windows. When llvm-driver support was added to llvm-profdata this InitLLVM call was effectively moved into the common llvm-driver wrapper mechanism. More recently, in llvm#162191, llvm-driver support was temporarily backed out of llvm-profdata due to an issue with `cl::opt` handling. This change reintroduces the direct call to InitLLVM in order to restore wildcard expansion and also adds a test for the wildcard expansion on Windows.
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.