[PATCH] D99395: [Propeller] Do not generate the BB address map for empty functions.

Rahman Lavaee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 29 20:15:10 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG90c401cab634: [Propeller] Do not generate the BB address map for empty functions. (authored by rahmanl).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99395/new/

https://reviews.llvm.org/D99395

Files:
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/test/CodeGen/X86/basic-block-sections-labels-empty-function.ll


Index: llvm/test/CodeGen/X86/basic-block-sections-labels-empty-function.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/X86/basic-block-sections-labels-empty-function.ll
@@ -0,0 +1,21 @@
+;; Verify that the BB address map is not emitted for empty functions.
+; RUN: llc < %s -mtriple=x86_64 -basic-block-sections=labels | FileCheck %s
+
+define void @empty_func() {
+entry:
+  unreachable
+}
+; CHECK:		{{^ *}}.text{{$}}
+; CHECK:	empty_func:
+; CHECK:	.Lfunc_begin0:
+; CHECK-NOT:	.section	.llvm_bb_addr_map
+
+define void @func() {
+entry:
+  ret void
+}
+
+; CHECK:	func:
+; CHECK:	.Lfunc_begin1:
+; CHECK:		.section	.llvm_bb_addr_map,"o", at llvm_bb_addr_map,.text{{$}}
+; CHECK:		.quad	.Lfunc_begin1
Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1430,8 +1430,8 @@
   }
 
   // Emit section containing BB address offsets and their metadata, when
-  // BB labels are requested for this function.
-  if (MF->hasBBLabels())
+  // BB labels are requested for this function. Skip empty functions.
+  if (MF->hasBBLabels() && HasAnyRealCode)
     emitBBAddrMapSection(*MF);
 
   // Emit section containing stack size metadata.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99395.334041.patch
Type: text/x-patch
Size: 1351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210330/7dbbfcf0/attachment.bin>


More information about the llvm-commits mailing list