[PATCH] D39396: Fix for PR33930. Short-circuit metadata mapping when cloning a varargs thunk.
Adrian Prantl via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 30 08:56:45 PDT 2017
aprantl added a comment.
> The only drawback is that the cloned function's (the thunk's) DILocalVariableNodes will not appear in the newly cloned DISubprogram's node variable list. Instead, the new node points to the original function's variable list. However, since the only difference between the original function and the thunk is the this-ptr adjustment, the resulting debug information is correct, at least in the test cases I have looked at.
Does the thunk contain any local variables other than function arguments?
What I'm getting at is: If this is only a thunk, do we need any local variables at all?
================
Comment at: lib/CodeGen/CGVTables.cpp:130
+// Furthermore, the function resolves any DILocalVariable nodes referenced
+// by dbg.value intrinsics so they can be properly mapped during cloning.
+static void resolveTopLevelMetadata(llvm::Function *Fn,
----------------
`///`
================
Comment at: lib/CodeGen/CGVTables.cpp:140
+
+ // Find all debug.declare intrinsics and resolve the DILocalVariable nodes
+ // they are referencing.
----------------
`debug.declare` -> (llvm.)`dbg.declare`.
================
Comment at: lib/CodeGen/CGVTables.cpp:143
+ for (llvm::Function::iterator BB = Fn->begin(), E = Fn->end(); BB != E;
+ ++BB) {
+ for (llvm::Instruction &I : *BB) {
----------------
does this work?
`for (auto &BB : Fn->getBasicBlockList())`
================
Comment at: lib/CodeGen/CGVTables.cpp:145
+ for (llvm::Instruction &I : *BB) {
+ auto *DII = dyn_cast<llvm::DbgInfoIntrinsic>(&I);
+ if (DII) {
----------------
`if (auto *DII ...`
https://reviews.llvm.org/D39396
More information about the cfe-commits
mailing list