[PATCH] D59552: [Linker] Fix crash handling appending linkage

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 12:45:22 PDT 2019


efriedma added inline comments.


================
Comment at: lib/Linker/IRMover.cpp:1059
+void IRLinker::flushRAUWWorklist() {
+  std::reverse(RAUWWorklist.begin(), RAUWWorklist.end());
+  while (!RAUWWorklist.empty()) {
----------------
Why is the call to std::reverse() necessary?  There shouldn't be any other code touching the worklist, so you can just iterate over it normally.


================
Comment at: lib/Linker/IRMover.cpp:1067
+    Old->replaceAllUsesWith(New);
+    Old->eraseFromParent();
+  }
----------------
ValueMap and AliasValueMap use raw pointers for keys.  Do we need to update them if one of those pointers is deleted?


================
Comment at: lib/Linker/IRMover.cpp:1396
       return std::move(*FoundError);
+    flushRAUWWorklist();
   }
----------------
I guess you can just flush the worklist here because the mapValue() invariant only applies inside a single call?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D59552





More information about the llvm-commits mailing list