[PATCH] Linker: Replace overridden subprograms

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Dec 16 13:27:09 PST 2014


+  // Don't drop subprograms if the new module doesn't have debug info.
+  if (!SrcM->getNamedMetadata("llvm.dbg.cu"))
+    return;

Why? It seems better for the linker to have a simpler logic: keep the
matching debug info, even if it is empty. With the _odr variants it is
probably not a big issue, but a weak function is allowed to replace a
completely different linkonce function for example.

+  for (unsigned I = 0, E = CompileUnits->getNumOperands(); I != E; ++I) {

Can this be a range loop?

+    for (unsigned S = 0, SE = SPs.getNumElements(); S != SE; ++S) {

and this one?

The bigger question is the asymmetry. If a function in the source
replaces one in the destination, this will drop the subprogram in the
destination. If we decide not to copy a function from the source, we
are still copying the subprogram, no?

Cheers,
Rafael



More information about the llvm-commits mailing list