[llvm] [polly] [Plugins] Address review comments on -plugin-arg (PR #227545)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 00:35:24 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;
----------------
MaskRay wrote:

Agreed. There is no an error even without `-plugin-arg`
`RUN: %if !linked-bye %{ not opt %s %loadnewpmbye %loadnewpmbye -disable-output 2>&1 | FileCheck %s --check-prefix=DUP %}`

https://github.com/llvm/llvm-project/pull/227545


More information about the llvm-commits mailing list