[llvm] [polly] [Plugins] Address review comments on -plugin-arg (PR #227545)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 22:50:32 PDT 2026
================
@@ -53,19 +52,28 @@ Expected<PassPlugin> PassPlugin::load(StringRef Filename) {
Error llvm::passPluginArguments(ArrayRef<PassPluginLibraryInfo> Infos,
ArrayRef<std::string> Args) {
+ constexpr unsigned Ambiguous = -1u;
DenseMap<StringRef, unsigned> Index;
- for (auto [I, Info] : enumerate(Infos))
- Index[Info.PluginName] = I;
- // The argument follows the first comma, so it is NUL-terminated.
+ for (auto [I, Info] : enumerate(Infos)) {
+ auto [It, Inserted] = Index.try_emplace(Info.PluginName, I);
+ if (!Inserted)
+ It->second = Ambiguous;
----------------
serge-sans-paille wrote:
It seems a bit strange that the check for ambiguity happens later in this function, only for pass plugin argument. Shouldn't we hard-fail if we load two plugins with the same name?
Note that I understand that the plugin name plays a minor role in the plugin behavior, but we can also imagine that the plugin name would be used for warnings etc, and ambiguity will live there too.
https://github.com/llvm/llvm-project/pull/227545
More information about the llvm-commits
mailing list