[llvm] r231198 - Use the vanilla func_end symbol for .size.

Rafael Espindola rafael.espindola at gmail.com
Tue Mar 3 17:35:23 PST 2015


Author: rafael
Date: Tue Mar  3 19:35:23 2015
New Revision: 231198

URL: http://llvm.org/viewvc/llvm-project?rev=231198&view=rev
Log:
Use the vanilla func_end symbol for .size.

No need to create yet another temp symbol.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/test/CodeGen/PowerPC/empty-functions.ll
    llvm/trunk/test/CodeGen/PowerPC/ppc64-linux-func-size.ll
    llvm/trunk/test/CodeGen/SPARC/empty-functions.ll
    llvm/trunk/test/CodeGen/X86/empty-functions.ll
    llvm/trunk/test/CodeGen/X86/statepoint-call-lowering.ll
    llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll
    llvm/trunk/test/DebugInfo/X86/pr19307.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=231198&r1=231197&r2=231198&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Mar  3 19:35:23 2015
@@ -882,7 +882,7 @@ void AsmPrinter::EmitFunctionBody() {
   // Emit target-specific gunk after the function body.
   EmitFunctionBodyEnd();
 
-  if (!MMI->getLandingPads().empty()) {
+  if (!MMI->getLandingPads().empty() || MAI->hasDotTypeDotSizeDirective()) {
     // Create a symbol for the end of function.
     CurrentFnEnd = createTempSymbol("func_end", getFunctionNumber());
     OutStreamer.EmitLabel(CurrentFnEnd);
@@ -891,13 +891,10 @@ void AsmPrinter::EmitFunctionBody() {
   // If the target wants a .size directive for the size of the function, emit
   // it.
   if (MAI->hasDotTypeDotSizeDirective()) {
-    // Create a symbol for the end of function, so we can get the size as
-    // difference between the function label and the temp label.
-    MCSymbol *FnEndLabel = OutContext.CreateTempSymbol();
-    OutStreamer.EmitLabel(FnEndLabel);
-
+    // We can get the size as difference between the function label and the
+    // temp label.
     const MCExpr *SizeExp =
-      MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(FnEndLabel, OutContext),
+      MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(CurrentFnEnd, OutContext),
                               MCSymbolRefExpr::Create(CurrentFnSymForSize,
                                                       OutContext),
                               OutContext);

Modified: llvm/trunk/test/CodeGen/PowerPC/empty-functions.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/empty-functions.ll?rev=231198&r1=231197&r2=231198&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/empty-functions.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/empty-functions.ll Tue Mar  3 19:35:23 2015
@@ -39,5 +39,5 @@ entry:
 ; LINUX-FP-NEXT:{{^}}.L{{.*}}:{{$}}
 ; LINUX-FP-NEXT: .cfi_def_cfa_register r31
 ; LINUX-FP-NEXT:{{^}}.L{{.*}}:{{$}}
-; LINUX-FP-NEXT: .size   func, .Ltmp3-func
+; LINUX-FP-NEXT: .size   func, .Lfunc_end0-func
 ; LINUX-FP-NEXT: .cfi_endproc

Modified: llvm/trunk/test/CodeGen/PowerPC/ppc64-linux-func-size.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/ppc64-linux-func-size.ll?rev=231198&r1=231197&r2=231198&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/ppc64-linux-func-size.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/ppc64-linux-func-size.ll Tue Mar  3 19:35:23 2015
@@ -19,4 +19,4 @@ entry:
 ; however, using this directive with recent binutils will result in the error:
 ;  .size expression for XXX does not evaluate to a constant
 ; so we must use the label which actually tags the start of the function.
-; CHECK: .size	test1, .Ltmp0-.L.test1
+; CHECK: .size	test1, .Lfunc_end0-.L.test1

Modified: llvm/trunk/test/CodeGen/SPARC/empty-functions.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SPARC/empty-functions.ll?rev=231198&r1=231197&r2=231198&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/SPARC/empty-functions.ll (original)
+++ llvm/trunk/test/CodeGen/SPARC/empty-functions.ll Tue Mar  3 19:35:23 2015
@@ -28,5 +28,5 @@ entry:
 ; LINUX-FP-NEXT: {{^}}.L{{.*}}:{{$}}
 ; LINUX-FP-NEXT: .cfi_register 15, 31
 ; LINUX-FP-NEXT: {{^}}.L{{.*}}:{{$}}
-; LINUX-FP-NEXT: .size   func, .Ltmp3-func
+; LINUX-FP-NEXT: .size   func, .Lfunc_end0-func
 ; LINUX-FP-NEXT: .cfi_endproc

Modified: llvm/trunk/test/CodeGen/X86/empty-functions.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/empty-functions.ll?rev=231198&r1=231197&r2=231198&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/empty-functions.ll (original)
+++ llvm/trunk/test/CodeGen/X86/empty-functions.ll Tue Mar  3 19:35:23 2015
@@ -50,5 +50,5 @@ entry:
 ; LINUX-FP-NEXT:{{^}}.L{{.*}}:{{$}}
 ; LINUX-FP-NEXT: .cfi_def_cfa_register %rbp
 ; LINUX-FP-NEXT:{{^}}.L{{.*}}:{{$}}
-; LINUX-FP-NEXT: .size   func, .Ltmp3-func
+; LINUX-FP-NEXT: .size   func, .Lfunc_end0-func
 ; LINUX-FP-NEXT: .cfi_endproc

Modified: llvm/trunk/test/CodeGen/X86/statepoint-call-lowering.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/statepoint-call-lowering.ll?rev=231198&r1=231197&r2=231198&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/statepoint-call-lowering.ll (original)
+++ llvm/trunk/test/CodeGen/X86/statepoint-call-lowering.ll Tue Mar  3 19:35:23 2015
@@ -66,7 +66,7 @@ define i1 @test_relocate(i32 addrspace(1
 ; Check that an ununsed relocate has no code-generation impact
 ; CHECK: pushq %rax
 ; CHECK: callq return_i1
-; CHECK-NEXT: .Ltmp13:
+; CHECK-NEXT: .Ltmp9:
 ; CHECK-NEXT: popq %rdx
 ; CHECK-NEXT: retq
 entry:

Modified: llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll?rev=231198&r1=231197&r2=231198&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/debug-loc-asan.ll Tue Mar  3 19:35:23 2015
@@ -28,7 +28,7 @@
 
 ; Then it's addressed via %rsp:
 ; CHECK:      .quad [[START_LABEL]]-.Lfunc_begin0
-; CHECK-NEXT: .Lfunc_end0-.Lfunc_begin0
+; CHECK-NEXT: .Lfunc_end06-.Lfunc_begin0
 ; CHECK: DW_OP_breg7
 ; CHECK-NEXT: [[OFFSET]]
 ; CHECK: DW_OP_deref

Modified: llvm/trunk/test/DebugInfo/X86/pr19307.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/pr19307.ll?rev=231198&r1=231197&r2=231198&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/pr19307.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/pr19307.ll Tue Mar  3 19:35:23 2015
@@ -21,7 +21,7 @@
 ; CHECK: .Ldebug_loc{{[0-9]+}}:
 ; CHECK: DW_OP_breg1
 ; CHECK:      .quad [[START_LABEL]]-.Lfunc_begin0
-; CHECK-NEXT: .quad .Lfunc_end0-.Lfunc_begin0
+; CHECK-NEXT: .quad .Lfunc_end09-.Lfunc_begin0
 ; CHECK: DW_OP_breg6
 ; CHECK: DW_OP_deref
 





More information about the llvm-commits mailing list