[PATCH] D20582: Don't add repeats of llvm.ident list when linking

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 22 09:55:38 PST 2019


dexonsmith added a comment.

In D20582#1407226 <https://reviews.llvm.org/D20582#1407226>, @arsenm wrote:

> In D20582#1407184 <https://reviews.llvm.org/D20582#1407184>, @dexonsmith wrote:
>
> > It’s unfortunate that this will be quadratic in the number of modules.  Is there a way we could improve that?
>
>
> Well the linker API only exposes linking one module into one other at at time, so I don't know. Currently we have the AMDGPUUnifyMetadata pass as a workaround which cleans these up in a pass over the fully linked module, so that avoids revisiting for each module but it would make more sense if the linker dealt with this.


I wonder whether it would be generally useful to support SetVectors in named metadata nodes.  I'm not sure what the textual IR syntax would be, but I believe debug info would use it too.



================
Comment at: lib/Linker/IRMover.cpp:1001-1005
+      for (const MDNode *DestID : DestNMD->operands()) {
+        if (const MDString *VerStr
+            = cast_or_null<MDString>(DestID->getOperand(0)))
+          UniqueIdents.insert(VerStr->getString());
+      }
----------------
Do you need to reach inside to the strings?  Why not just compare the nodes themselves?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D20582/new/

https://reviews.llvm.org/D20582





More information about the llvm-commits mailing list