[PATCH] D128374: [docs][NewPM] Add more info on why accessing mutable outer analyses is disallowed

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 22 13:53:20 PDT 2022


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm

Thanks for expanding our docs!



================
Comment at: llvm/docs/NewPassManager.rst:329-330
+as the key for cached analyses. Take care in the pass to either clear the
+results for that function, not create new functions which may reuse the same
+address as the deleted function, or not use analyses at all.
+
----------------
I would skip the second alternative. Leaving pointers to freed data as cache keys is unsafe at any speed. The only two solutions that work are to not use the inner analysis, or to clear the results for a function before it is deleted.

Personally, I like to call this problem "the ABA problem", but [[ https://en.wikipedia.org/wiki/ABA_problem | Wikipedia says ]] that has to do with concurrency, not cache keys.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128374



More information about the llvm-commits mailing list