[Mlir-commits] [mlir] [MLIR][LLVM] Recursion importer handle repeated self-references (PR #87295)
Billy Zhu
llvmlistbot at llvm.org
Tue Apr 9 06:28:00 PDT 2024
================
@@ -216,18 +216,15 @@ DebugTranslation::translateImpl(DIGlobalVariableAttr attr) {
llvm::DIType *
DebugTranslation::translateRecursive(DIRecursiveTypeAttrInterface attr) {
DistinctAttr recursiveId = attr.getRecId();
- if (attr.isRecSelf()) {
- auto *iter = recursiveTypeMap.find(recursiveId);
- assert(iter != recursiveTypeMap.end() && "unbound DI recursive self type");
+ if (auto *iter = recursiveTypeMap.find(recursiveId);
+ iter != recursiveTypeMap.end()) {
return iter->second;
+ } else {
+ assert(!attr.isRecSelf() && "unbound DI recursive self type");
}
auto setRecursivePlaceholder = [&](llvm::DIType *placeholder) {
- [[maybe_unused]] auto [iter, inserted] =
- recursiveTypeMap.try_emplace(recursiveId, placeholder);
- (void)iter;
- (void)inserted;
- assert(inserted && "illegal reuse of recursive id");
+ recursiveTypeMap.try_emplace(recursiveId, placeholder);
----------------
zyx-billy wrote:
So if my testing is correct, this fixes the memory leak: https://github.com/llvm/llvm-project/pull/88122. Apparently we were just caching temporary nodes, causing them to be reused after RAUW.
https://github.com/llvm/llvm-project/pull/87295
More information about the Mlir-commits
mailing list