[PATCH] D39953: [CodeGen] Do not lookup for cached TBAA metadata nodes twice

2017-11-17 Thread John McCall via Phabricator via cfe-commits
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

[PATCH] D39953: [CodeGen] Do not lookup for cached TBAA metadata nodes twice

2017-11-17 Thread Ivan Kosarev via Phabricator via cfe-commits
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

[PATCH] D39953: [CodeGen] Do not lookup for cached TBAA metadata nodes twice

2017-11-13 Thread John McCall via Phabricator via cfe-commits
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

[PATCH] D39953: [CodeGen] Do not lookup for cached TBAA metadata nodes twice

2017-11-13 Thread Ivan Kosarev via Phabricator via cfe-commits
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