Skip to content

Commit

Permalink
Emit prefix data after debug and EH directives.
Browse files Browse the repository at this point in the history
This ensures that the prefix data is treated as part of the function for
the purpose of debug info.  This provides a better debugging experience,
among other things by allowing a debug info client to correctly look up
a function in debug info given a function pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193042 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
pcc committed Oct 20, 2013
1 parent e52fac1 commit 0abc362
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,6 @@ void AsmPrinter::EmitFunctionHeader() {
OutStreamer.EmitLabel(DeadBlockSyms[i]);
}

// Emit the prefix data.
if (F->hasPrefixData())
EmitGlobalConstant(F->getPrefixData());

// Emit pre-function debug and/or EH information.
if (DE) {
NamedRegionTimer T(EHTimerName, DWARFGroupName, TimePassesIsEnabled);
Expand All @@ -475,6 +471,10 @@ void AsmPrinter::EmitFunctionHeader() {
NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);
DD->beginFunction(MF);
}

// Emit the prefix data.
if (F->hasPrefixData())
EmitGlobalConstant(F->getPrefixData());
}

/// EmitFunctionEntryLabel - Emit the label that is the entrypoint for the
Expand Down
2 changes: 2 additions & 0 deletions test/CodeGen/X86/prefixdata.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
@i = linkonce_odr global i32 1

; CHECK: f:
; CHECK-NEXT: .cfi_startproc
; CHECK-NEXT: .long 1
define void @f() prefix i32 1 {
ret void
}

; CHECK: g:
; CHECK-NEXT: .cfi_startproc
; CHECK-NEXT: .quad i
define void @g() prefix i32* @i {
ret void
Expand Down

0 comments on commit 0abc362

Please sign in to comment.