rjmccall added a comment.
I think having a primary function that handles the caching logic makes some
sense. I think there might be some cases that intentionally don't cache their
normal result, though, so it might be harder than you think. Up to you whether
you want to continue.
Repository
kosarev added a comment.
Indeed, DenseMap invalidates iterators on insertion. But then even the
"technically correct" part of these changes make things more fragile while my
original concern was reliability and not performance. I particularly don't like
the repeating cache assignments.
What if
rjmccall added inline comments.
Comment at: lib/CodeGen/CodeGenTBAA.cpp:267
+ if (N)
return N;
The main danger with persisting this kind of reference is that DenseMap doesn't
actually guarantee stability, so if there are recursive calls that can grow the
kosarev created this revision.
kosarev added a project: clang.
Repository:
rL LLVM
https://reviews.llvm.org/D39953
Files:
lib/CodeGen/CodeGenTBAA.cpp
Index: lib/CodeGen/CodeGenTBAA.cpp
===
--- lib/CodeGen/CodeGenTBAA.cpp
+++ li