djtodoro created this revision. djtodoro added reviewers: dblaikie, aprantl, vsk. djtodoro added projects: LLVM, debug-info. Herald added a project: clang. Herald added a subscriber: cfe-commits.
After the D70350 <https://reviews.llvm.org/D70350>, the `retainedTypes:` isn't being used for the purpose of call site debug info for extern calls, so it is safe to delete it from IR representation. We are also adding a test to ensure the subprogram isn't stored within the `retainedTypes:` from corresponding `DICompileUnit`. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D80369 Files: clang/lib/CodeGen/CGDebugInfo.cpp clang/test/CodeGen/debug-info-extern-call.c Index: clang/test/CodeGen/debug-info-extern-call.c =================================================================== --- clang/test/CodeGen/debug-info-extern-call.c +++ clang/test/CodeGen/debug-info-extern-call.c @@ -1,6 +1,10 @@ // When entry values are emitted, expect a subprogram for extern decls so that // the dwarf generator can describe call site parameters at extern call sites. // +// Initial implementation relied on the 'retainedTypes:' from the corresponding +// DICompileUnit, so we also ensure that we do not store the extern declaration +// subprogram into the 'retainedTypes:'. +// // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - \ // RUN: | FileCheck %s -check-prefix=DECLS-FOR-EXTERN @@ -17,6 +21,8 @@ // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -gsce -S -emit-llvm %s -o - \ // RUN: | FileCheck %s -check-prefix=NO-DECLS-FOR-EXTERN +// DECLS-FOR-EXTERN-NOT: !DICompileUnit({{.*}}retainedTypes: ![[RETTYPES:[0-9]+]] +// DECLS-FOR-EXTERN-NOT: ![[RETTYPES]] = !{ // DECLS-FOR-EXTERN: !DISubprogram(name: "fn1" // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp" // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name" Index: clang/lib/CodeGen/CGDebugInfo.cpp =================================================================== --- clang/lib/CodeGen/CGDebugInfo.cpp +++ clang/lib/CodeGen/CGDebugInfo.cpp @@ -3870,8 +3870,6 @@ if (IsDeclForCallSite) Fn->setSubprogram(SP); - - DBuilder.retainType(SP); } void CGDebugInfo::EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke,
Index: clang/test/CodeGen/debug-info-extern-call.c =================================================================== --- clang/test/CodeGen/debug-info-extern-call.c +++ clang/test/CodeGen/debug-info-extern-call.c @@ -1,6 +1,10 @@ // When entry values are emitted, expect a subprogram for extern decls so that // the dwarf generator can describe call site parameters at extern call sites. // +// Initial implementation relied on the 'retainedTypes:' from the corresponding +// DICompileUnit, so we also ensure that we do not store the extern declaration +// subprogram into the 'retainedTypes:'. +// // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - \ // RUN: | FileCheck %s -check-prefix=DECLS-FOR-EXTERN @@ -17,6 +21,8 @@ // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -gsce -S -emit-llvm %s -o - \ // RUN: | FileCheck %s -check-prefix=NO-DECLS-FOR-EXTERN +// DECLS-FOR-EXTERN-NOT: !DICompileUnit({{.*}}retainedTypes: ![[RETTYPES:[0-9]+]] +// DECLS-FOR-EXTERN-NOT: ![[RETTYPES]] = !{ // DECLS-FOR-EXTERN: !DISubprogram(name: "fn1" // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp" // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name" Index: clang/lib/CodeGen/CGDebugInfo.cpp =================================================================== --- clang/lib/CodeGen/CGDebugInfo.cpp +++ clang/lib/CodeGen/CGDebugInfo.cpp @@ -3870,8 +3870,6 @@ if (IsDeclForCallSite) Fn->setSubprogram(SP); - - DBuilder.retainType(SP); } void CGDebugInfo::EmitFuncDeclForCallSite(llvm::CallBase *CallOrInvoke,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits