[PATCH] D51443: [dsymutil] Remove non-determinism.

Frederic Riss via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 29 14:21:42 PDT 2018


friss added inline comments.


================
Comment at: llvm/tools/dsymutil/DwarfLinker.cpp:280
+/// of the clone step.
+static bool updatePruning(const DWARFDie &DIE, CompileUnit &CU) {
+  unsigned MyIdx = CU.getOrigUnit().getDIEIndex(DIE);
----------------
Can you try something different (which - I believe - should give the same result):

```
static void updatePruning(const CompileUnit::DIEInfo &Info, CompileUnit &CU) {
    if (!Info.Prune || !Info.Ctxt || Info.Ctxt->getCanonicalDIEOffset())
        return;
    Info.Prune = false;
    unsigned int ParentIdx = Info.ParentIdx;
    do {
        CompileUnit::DIEInfo &ParentInfo = CU.getInfo(ParentIdx);
        if (!ParentInfo.Prune)
            return;
        ParentInfo.Prune = false;
        ParentIdx = ParentInfo.ParentIdx;
    } while (ParentIdx != 0);
}
```

and then instead of doing another loop over all the DIEs, add this at the beginning of the wordlist iteration in lookForDIEsToKeep:
```
if (!flags)
    updatePrune(MyInfo, CU);
```
Not sure whether it's going to be better performance wise, but it's worth a shot.


Repository:
  rL LLVM

https://reviews.llvm.org/D51443





More information about the llvm-commits mailing list