<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61147>61147</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
CommandLine Error: Option 'enable-fs-discriminator' registered more than once
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Qfrost911
</td>
</tr>
</table>
<pre>
Env:
Ubuntu18
LLVM 17 (last commit: 0ec4cae146e37d97f39818d89e4f2209dcde38ee )
When I use a IR plugin in clang or opt, an error was raised.
`
root@qfrost:/mnt/c/pass# clang++ -fpass-plugin='build/NewModulePass.so' -o build/out.out test/default.cpp
clang (LLVM option parsing): CommandLine Error: Option 'enable-fs-discriminator' registered more than once!
fatal error: error in backend: inconsistency in registered CommandLine options
clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
`
`
opt: CommandLine Error: Option 'enable-fs-discriminator' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
Stack dump:
0. Program arguments: opt --load-pass-plugin=build/NewModulePass.so --passes=NewModulePass build/1-target_before.bc -o build/2-target_after.bc
`
I think this code can running perfect in LLVM16, and this error was introduced when I have updated my LLVM to 17.
`
struct NewModulePass : public PassInfoMixin<NewModulePass> {
static bool isRequired() { return true; }
PreservedAnalyses run(Module &M, llvm::AnalysisManager<llvm::Module>& PAM) {
errs() << "[+] NewModulePass: " << M.getName() << '\n';
return PreservedAnalyses::all();
}
};
extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK llvmGetPassPluginInfo() { \
return {LLVM_PLUGIN_API_VERSION, "NewModulePass", "v0.1", [](::llvm::PassBuilder &PB) { \
PB.registerPipelineParsingCallback([](::llvm::StringRef PassName, ::llvm::ModulePassManager &MPM, \
::llvm::ArrayRef<::llvm::PassBuilder::PipelineElement>) { \
if (PassName == "NewModulePass") { \
printf("[+] addPass\n"); \
MPM.addPass(NewModulePass()); \
return true; \
} \
return false; \
}); \
PB.registerPipelineStartEPCallback( \
[](::llvm::ModulePassManager &MPM, ::llvm::OptimizationLevel Level) { \
printf("[+] addPass\n"); \
MPM.addPass(NewModulePass()); \
}); \
}}; \
}
`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vt1y4jgTfRpx04XLlgHjCy74yxT1hQwfmZ_LlGy1QTu25JFkMtmn35IEgTBJZndrx1QJW2p1nz591DYzRuwk4oQMZ2S46LHO7pWe_L_Sytg8SXqF4k-TpTyQdEriBYmnn4tO2i4Zh6fb2y9rSDIgdFwzY6FUTSMsSacQYzkoGSaDEaYZz7MqzcfJmI9zHFSUxjkvOaZjRCA0D77C-HWPElbQGQQGqy20dbcTEoSEsmZyB0qDai2hc2ASUGul4ZEZ0EwY5NHR0ygON1opSwbxd5-OS4HeNNISelMSetMyYwhNg19CZ4TOoF-52X4IStIFoVnRiZoTenOHj2vFuxo3zJjIKEIz6Cs4LavORqqzYNG4ABwr1tU2Kts2QAnoCR17ylRrhZLQMm2EC547yuaqaZjkt0IiLF1mbvJjsCQ0Q8mKGvuV6XNhSi0aIZlV2uHQuBPGokYOjdIIds8kKFkioUkIXzHL6sCX8xqIExIKVn5Dyd2ckKWSxvmR5ZNbu_B6CS1gNxdpBfKe_bqbkG6llbQoudcFkxwqJmrk8CjsHvCHcILhCFnsiHEl7x_AKjCIIORBlcxFOgvkVNbnG6eE30ycL9dyu_24_dcc3VtWfgPeNe3zKYoj2Gi106wBpnddg9Ia51-1Fvr9WjHefynEt1QIfW-IhqSLF2vPwkz6lukd2ocCK6UxKspL2dLTKqss6qgor6n24wrsXshvbjShZCWToDsphdxBi7rC0jo6HFvJKJxOHszPZ1RIqxXvSieAcMr37IDQtZxZV4Anv90JIMmuT7KxuistvEzRMdZ2RS1KcM8rWam1-OH4mr8wJOkSSDYLnsBYZkUJhVI1CLPF753QyAkdE5o7M9BoOy3B6g5JOgOSLS65AADYaDSoD8inktVPBo3j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