[PATCH] D61826: [BPF] emit BTF sections only if debuginfo available

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 12 21:58:49 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL360556: [BPF] emit BTF sections only if debuginfo available (authored by yhs, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61826?vs=199148&id=199204#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61826

Files:
  llvm/trunk/lib/Target/BPF/BPFAsmPrinter.cpp
  llvm/trunk/test/CodeGen/BPF/BTF/char-no-debuginfo.ll


Index: llvm/trunk/lib/Target/BPF/BPFAsmPrinter.cpp
===================================================================
--- llvm/trunk/lib/Target/BPF/BPFAsmPrinter.cpp
+++ llvm/trunk/lib/Target/BPF/BPFAsmPrinter.cpp
@@ -54,7 +54,8 @@
 bool BPFAsmPrinter::doInitialization(Module &M) {
   AsmPrinter::doInitialization(M);
 
-  if (MAI->doesSupportDebugInformation()) {
+  // Only emit BTF when debuginfo available.
+  if (MAI->doesSupportDebugInformation() && !empty(M.debug_compile_units())) {
     Handlers.emplace_back(llvm::make_unique<BTFDebug>(this), "emit",
                           "Debug Info Emission", "BTF", "BTF Emission");
   }
Index: llvm/trunk/test/CodeGen/BPF/BTF/char-no-debuginfo.ll
===================================================================
--- llvm/trunk/test/CodeGen/BPF/BTF/char-no-debuginfo.ll
+++ llvm/trunk/test/CodeGen/BPF/BTF/char-no-debuginfo.ll
@@ -0,0 +1,31 @@
+; RUN: llc -march=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
+; RUN: llc -march=bpfeb -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
+
+; Source code:
+;   int g __attribute__((section("maps"))) = 5;
+;   int test() { return g; }
+; Compilation flag:
+;   clang -target bpf -O2 -S -emit-llvm t.c
+
+ at g = dso_local local_unnamed_addr global i32 5, section "maps", align 4
+
+; Function Attrs: norecurse nounwind readonly
+define dso_local i32 @test() local_unnamed_addr #0 {
+  %1 = load i32, i32* @g, align 4, !tbaa !2
+  ret i32 %1
+}
+
+; CHECK-NOT:         .section        .BTF
+; CHECK-NOT:         .section        .BTF.ext
+
+attributes #0 = { norecurse nounwind readonly "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+!llvm.module.flags = !{!0}
+!llvm.ident = !{!1}
+
+!0 = !{i32 1, !"wchar_size", i32 4}
+!1 = !{!"clang version 8.0.20181009 "}
+!2 = !{!3, !3, i64 0}
+!3 = !{!"int", !4, i64 0}
+!4 = !{!"omnipotent char", !5, i64 0}
+!5 = !{!"Simple C/C++ TBAA"}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61826.199204.patch
Type: text/x-patch
Size: 2256 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190513/39e6831c/attachment.bin>


More information about the llvm-commits mailing list