[PATCH] D94202: Preserve the lexical order for global variables during llvm-link merge

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 16 16:53:13 PDT 2021


dexonsmith added a comment.

Or, maybe you can just splice as you go during your first iteration, and you don't need to sort at all or build up any maps...

  // Reorder the new globals to match the old order.
  for (GlobalVariable &GV : SrcM->globals()) {
    if (GV.hasAppendingLinkage())
      continue;
    auto NewValue = Mapper.mapValue(GV);
    if (!NewValue)
      continue;
    auto *NewGV = dyn_cast<GlobalVariable>(NewValue->stripPointerCasts());
    if (!NewGV)
      continue;
    Globals.splice(Globals.end(), Globals, NewGV->getIterator());
  }


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

https://reviews.llvm.org/D94202



More information about the llvm-commits mailing list