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
This commit is contained in:
Devang Patel 2010-06-04 22:27:30 +00:00
parent 7c21f747c7
commit 93031ac032
3 changed files with 4 additions and 6 deletions

View File

@ -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);
}

View File

@ -9,7 +9,7 @@ entry:
%"alloca point" = bitcast i32 0 to i32 ; <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

View File

@ -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