From 93031ac032219c2200de2df1c73e594a0496ecef Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Fri, 4 Jun 2010 22:27:30 +0000 Subject: [PATCH] Copy location info for current function argument from dbg.declare if respective store instruction does not have any location info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105490 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 6 ++---- test/Transforms/Mem2Reg/ConvertDebugInfo.ll | 2 +- test/Transforms/Mem2Reg/ConvertDebugInfo2.ll | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 87d0a107188..02eae5ba133 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -897,10 +897,8 @@ void PromoteMem2Reg::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI, // Propagate any debug metadata from the store onto the dbg.value. if (MDNode *SIMD = SI->getMetadata("dbg")) DbgVal->setMetadata("dbg", SIMD); - // Otherwise propagate debug metadata from dbg.declare for inlined fn args. - else if (!DISubprogram(DIVar.getContext()). - describes(DDI->getParent()->getParent())) - if (MDNode *MD = DDI->getMetadata("dbg")) + // Otherwise propagate debug metadata from dbg.declare. + else if (MDNode *MD = DDI->getMetadata("dbg")) DbgVal->setMetadata("dbg", MD); } diff --git a/test/Transforms/Mem2Reg/ConvertDebugInfo.ll b/test/Transforms/Mem2Reg/ConvertDebugInfo.ll index 37d27d4cb6d..2f1ccb493da 100644 --- a/test/Transforms/Mem2Reg/ConvertDebugInfo.ll +++ b/test/Transforms/Mem2Reg/ConvertDebugInfo.ll @@ -9,7 +9,7 @@ entry: %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] call void @llvm.dbg.declare(metadata !{i32* %i_addr}, metadata !0), !dbg !8 ; CHECK: call void @llvm.dbg.value(metadata !{i32 %i}, i64 0, metadata !0) -; CHECK: call void @llvm.dbg.value(metadata !{double %j}, i64 0, metadata !8) +; CHECK: call void @llvm.dbg.value(metadata !{double %j}, i64 0, metadata !9) store i32 %i, i32* %i_addr call void @llvm.dbg.declare(metadata !{double* %j_addr}, metadata !9), !dbg !8 store double %j, double* %j_addr diff --git a/test/Transforms/Mem2Reg/ConvertDebugInfo2.ll b/test/Transforms/Mem2Reg/ConvertDebugInfo2.ll index e637a0f0cd8..4cb621f61ca 100644 --- a/test/Transforms/Mem2Reg/ConvertDebugInfo2.ll +++ b/test/Transforms/Mem2Reg/ConvertDebugInfo2.ll @@ -1,4 +1,4 @@ -; RUN: opt -mem2reg < %s | llvm-dis | grep ".dbg " | count 6 +; RUN: opt -mem2reg < %s | llvm-dis | grep ".dbg " | count 7 declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone -- 2.34.1