Emit prefix data after debug and EH directives.
authorPeter Collingbourne <peter@pcc.me.uk>
Sun, 20 Oct 2013 02:16:21 +0000 (02:16 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Sun, 20 Oct 2013 02:16:21 +0000 (02:16 +0000)
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.

llvm-svn: 193042

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/test/CodeGen/X86/prefixdata.ll

index 0fe341a24318409ecb9672dbbb78138d1d496e0f..969a8dfeaea372d4a296e742556d585f9795858e 100644 (file)
@@ -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);
@@ -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
index 2ffa89d287d85981a648c46c254eec9de225ff00..2ec1892dd183a71b0db9b7d3648dc72013632161 100644 (file)
@@ -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