-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[BPF] Use ".L" local prefix label for basic blocks #95103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Previously, PrivateLabelPrefix was default-initialized to "L", so basic block labels were added to the symbol table. This seems like an oversight, so use ".L" for all private labels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to add dot. The bpf asm code is often read my humans and extra dot is a visual noise.
Is there any technical reason for this deviation? On all other ELF targets, local labels are prefixed with Would removing the dot from private global symbols be an option, so that they are prefixed with (Just for clarity: I don't care whether it's |
that's a regression. they didn't meant to be in symbol table.
Yep. PrivateGlobalPrefix = PrivateLabelPrefix = "L" is certainly better. |
@llvm/pr-subscribers-llvm-binary-utilities @llvm/pr-subscribers-mc Author: None (aengelke) ChangesPreviously, PrivateLabelPrefix was default-initialized to "L", so basic block labels were added to the symbol table. This seems like an oversight, so use ".L" for all private labels. I'm not sure whether this is correct. But there's no documentation anywhere that states something else and MCAsmInfo.h documentation states that PrivateLabelPrefix "Defaults to the same as PrivateGlobalPrefix," so this really seems like an oversight. Also, BPF is the only target where private label and global prefixes differ. Patch is 93.13 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/95103.diff 92 Files Affected:
diff --git a/llvm/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h b/llvm/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h
index 7b2168458c930..8a3c9fb47cc00 100644
--- a/llvm/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h
+++ b/llvm/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h
@@ -24,7 +24,6 @@ class BPFMCAsmInfo : public MCAsmInfo {
if (TT.getArch() == Triple::bpfeb)
IsLittleEndian = false;
- PrivateGlobalPrefix = ".L";
WeakRefDirective = "\t.weak\t";
UsesELFSectionDirectiveForBSS = true;
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp
index 26e9f9eb3f327..1206863010aa2 100644
--- a/llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -129,7 +129,7 @@ MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
assert(!Suffix.empty());
SmallString<60> NameStr;
- NameStr += GV->getParent()->getDataLayout().getPrivateGlobalPrefix();
+ NameStr += getContext().getAsmInfo()->getPrivateGlobalPrefix();
TM.getNameWithPrefix(NameStr, GV, *Mang);
NameStr.append(Suffix.begin(), Suffix.end());
return getContext().getOrCreateSymbol(NameStr);
diff --git a/llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id-2.ll b/llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id-2.ll
index 63c56c4dfec57..e034656e06330 100644
--- a/llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id-2.ll
+++ b/llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id-2.ll
@@ -39,7 +39,7 @@ entry:
; CHECK: .long 16 # FieldReloc
; CHECK-NEXT: .long 10 # Field reloc section string offset=10
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 4
; CHECK-NEXT: .long 20
; CHECK-NEXT: .long 7
diff --git a/llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id-local.ll b/llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id-local.ll
index 763b7345dcb83..28801fe5e4122 100644
--- a/llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id-local.ll
+++ b/llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id-local.ll
@@ -39,7 +39,7 @@ entry:
; CHECK: .long 16 # FieldReloc
; CHECK-NEXT: .long 10 # Field reloc section string offset=10
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 4
; CHECK-NEXT: .long 20
; CHECK-NEXT: .long 7
diff --git a/llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id.ll b/llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id.ll
index 2fb8d25a2e07b..ab46b1b1cf1a6 100644
--- a/llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id.ll
+++ b/llvm/test/CodeGen/BPF/BTF/builtin-btf-type-id.ll
@@ -83,15 +83,15 @@ entry:
; CHECK: .long 16 # FieldReloc
; CHECK-NEXT: .long 7 # Field reloc section string offset=7
; CHECK-NEXT: .long 3
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 3
; CHECK-NEXT: .long 48
; CHECK-NEXT: .long 6
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 10
; CHECK-NEXT: .long 48
; CHECK-NEXT: .long 6
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 4
; CHECK-NEXT: .long 48
; CHECK-NEXT: .long 7
diff --git a/llvm/test/CodeGen/BPF/BTF/filename.ll b/llvm/test/CodeGen/BPF/BTF/filename.ll
index 2ae03a64770e9..5ec74c7c2d607 100644
--- a/llvm/test/CodeGen/BPF/BTF/filename.ll
+++ b/llvm/test/CodeGen/BPF/BTF/filename.ll
@@ -53,12 +53,12 @@ define dso_local i32 @test() local_unnamed_addr #0 !dbg !7 {
; CHECK-NEXT: .long 8 # FuncInfo
; CHECK-NEXT: .long 10 # FuncInfo section string offset=10
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Lfunc_begin{{[0-9]+}}
+; CHECK-NEXT: .long Lfunc_begin{{[0-9]+}}
; CHECK-NEXT: .long 3
; CHECK-NEXT: .long 16 # LineInfo
; CHECK-NEXT: .long 10 # LineInfo section string offset=10
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 16
; CHECK-NEXT: .long 0
; CHECK-NEXT: .long 1038 # Line 1 Col 14
diff --git a/llvm/test/CodeGen/BPF/BTF/func-func-ptr.ll b/llvm/test/CodeGen/BPF/BTF/func-func-ptr.ll
index ea93225e8d588..9abd0b8fcc6f9 100644
--- a/llvm/test/CodeGen/BPF/BTF/func-func-ptr.ll
+++ b/llvm/test/CodeGen/BPF/BTF/func-func-ptr.ll
@@ -84,12 +84,12 @@ entry:
; CHECK-NEXT: .long 8 # FuncInfo
; CHECK-NEXT: .long 11 # FuncInfo section string offset=11
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Lfunc_begin0
+; CHECK-NEXT: .long Lfunc_begin0
; CHECK-NEXT: .long 3
; CHECK-NEXT: .long 16 # LineInfo
; CHECK-NEXT: .long 11 # LineInfo section string offset=11
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 17
; CHECK-NEXT: .long 0
; CHECK-NEXT: .long 3091 # Line 3 Col 19
diff --git a/llvm/test/CodeGen/BPF/BTF/func-non-void.ll b/llvm/test/CodeGen/BPF/BTF/func-non-void.ll
index 428dfac2e53d5..5ff9e92063121 100644
--- a/llvm/test/CodeGen/BPF/BTF/func-non-void.ll
+++ b/llvm/test/CodeGen/BPF/BTF/func-non-void.ll
@@ -58,16 +58,16 @@ define dso_local i32 @f1(i32 returned) local_unnamed_addr #0 !dbg !7 {
; CHECK-NEXT: .long 8 # FuncInfo
; CHECK-NEXT: .long 11 # FuncInfo section string offset=11
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Lfunc_begin0
+; CHECK-NEXT: .long Lfunc_begin0
; CHECK-NEXT: .long 3
; CHECK-NEXT: .long 16 # LineInfo
; CHECK-NEXT: .long 11 # LineInfo section string offset=11
; CHECK-NEXT: .long 2
-; CHECK-NEXT: .long .Lfunc_begin0
+; CHECK-NEXT: .long Lfunc_begin0
; CHECK-NEXT: .long 17
; CHECK-NEXT: .long 0
; CHECK-NEXT: .long 1024 # Line 1 Col 0
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 17
; CHECK-NEXT: .long 0
; CHECK-NEXT: .long 1042 # Line 1 Col 18
diff --git a/llvm/test/CodeGen/BPF/BTF/func-source.ll b/llvm/test/CodeGen/BPF/BTF/func-source.ll
index 63814d766e6a2..868aa826da277 100644
--- a/llvm/test/CodeGen/BPF/BTF/func-source.ll
+++ b/llvm/test/CodeGen/BPF/BTF/func-source.ll
@@ -53,12 +53,12 @@ entry:
; CHECK-NEXT: .long 8 # FuncInfo
; CHECK-NEXT: .long 3 # FuncInfo section string offset=3
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Lfunc_begin0
+; CHECK-NEXT: .long Lfunc_begin0
; CHECK-NEXT: .long 2
; CHECK-NEXT: .long 16 # LineInfo
; CHECK-NEXT: .long 3 # LineInfo section string offset=3
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 9
; CHECK-NEXT: .long 18
; CHECK-NEXT: .long 1040 # Line 1 Col 16
diff --git a/llvm/test/CodeGen/BPF/BTF/func-typedef.ll b/llvm/test/CodeGen/BPF/BTF/func-typedef.ll
index ac0813f8a342f..bda2f27255d32 100644
--- a/llvm/test/CodeGen/BPF/BTF/func-typedef.ll
+++ b/llvm/test/CodeGen/BPF/BTF/func-typedef.ll
@@ -71,16 +71,16 @@ entry:
; CHECK-NEXT: .long 8 # FuncInfo
; CHECK-NEXT: .long 20 # FuncInfo section string offset=20
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Lfunc_begin0
+; CHECK-NEXT: .long Lfunc_begin0
; CHECK-NEXT: .long 5
; CHECK-NEXT: .long 16 # LineInfo
; CHECK-NEXT: .long 20 # LineInfo section string offset=20
; CHECK-NEXT: .long 2
-; CHECK-NEXT: .long .Lfunc_begin0
+; CHECK-NEXT: .long Lfunc_begin0
; CHECK-NEXT: .long 26
; CHECK-NEXT: .long 0
; CHECK-NEXT: .long 3072 # Line 3 Col 0
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 26
; CHECK-NEXT: .long 0
; CHECK-NEXT: .long 3092 # Line 3 Col 20
diff --git a/llvm/test/CodeGen/BPF/BTF/func-unused-arg.ll b/llvm/test/CodeGen/BPF/BTF/func-unused-arg.ll
index 95c2f9d4e1c8f..243f2ba770372 100644
--- a/llvm/test/CodeGen/BPF/BTF/func-unused-arg.ll
+++ b/llvm/test/CodeGen/BPF/BTF/func-unused-arg.ll
@@ -58,12 +58,12 @@ define dso_local i32 @f1(i32) local_unnamed_addr #0 !dbg !7 {
; CHECK-NEXT: .long 8 # FuncInfo
; CHECK-NEXT: .long 11 # FuncInfo section string offset=11
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Lfunc_begin0
+; CHECK-NEXT: .long Lfunc_begin0
; CHECK-NEXT: .long 3
; CHECK-NEXT: .long 16 # LineInfo
; CHECK-NEXT: .long 11 # LineInfo section string offset=11
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 17
; CHECK-NEXT: .long 0
; CHECK-NEXT: .long 1042 # Line 1 Col 18
diff --git a/llvm/test/CodeGen/BPF/BTF/func-void.ll b/llvm/test/CodeGen/BPF/BTF/func-void.ll
index 94770dba455e0..c4638533dfcfd 100644
--- a/llvm/test/CodeGen/BPF/BTF/func-void.ll
+++ b/llvm/test/CodeGen/BPF/BTF/func-void.ll
@@ -47,12 +47,12 @@ define dso_local void @f1() local_unnamed_addr #0 !dbg !7 {
; CHECK-NEXT: .long 8 # FuncInfo
; CHECK-NEXT: .long 4 # FuncInfo section string offset=4
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Lfunc_begin0
+; CHECK-NEXT: .long Lfunc_begin0
; CHECK-NEXT: .long 2
; CHECK-NEXT: .long 16 # LineInfo
; CHECK-NEXT: .long 4 # LineInfo section string offset=4
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 10
; CHECK-NEXT: .long 0
; CHECK-NEXT: .long 1040 # Line 1 Col 16
diff --git a/llvm/test/CodeGen/BPF/CORE/anon-struct-argument-pragma.ll b/llvm/test/CodeGen/BPF/CORE/anon-struct-argument-pragma.ll
index 46507e3338211..bf12d91267ace 100644
--- a/llvm/test/CodeGen/BPF/CORE/anon-struct-argument-pragma.ll
+++ b/llvm/test/CodeGen/BPF/CORE/anon-struct-argument-pragma.ll
@@ -46,7 +46,7 @@ entry:
; CHECK: .long 16 # FieldReloc
; CHECK-NEXT: .long 59 # Field reloc section string offset=59
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp[[#]]
+; CHECK-NEXT: .long Ltmp[[#]]
; CHECK-NEXT: .long 2
; CHECK-NEXT: .long 65
; CHECK-NEXT: .long 0
diff --git a/llvm/test/CodeGen/BPF/CORE/anon-union-localvar-attr.ll b/llvm/test/CodeGen/BPF/CORE/anon-union-localvar-attr.ll
index dd8c86897275e..7df73114b2fc8 100644
--- a/llvm/test/CodeGen/BPF/CORE/anon-union-localvar-attr.ll
+++ b/llvm/test/CodeGen/BPF/CORE/anon-union-localvar-attr.ll
@@ -47,7 +47,7 @@ entry:
; CHECK: .long 16 # FieldReloc
; CHECK-NEXT: .long 10 # Field reloc section string offset=10
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp[[#]]
+; CHECK-NEXT: .long Ltmp[[#]]
; CHECK-NEXT: .long 7
; CHECK-NEXT: .long 101
; CHECK-NEXT: .long 1
diff --git a/llvm/test/CodeGen/BPF/CORE/anon-union-localvar-pragma.ll b/llvm/test/CodeGen/BPF/CORE/anon-union-localvar-pragma.ll
index d2fee10d27710..11ae69dc3d1b0 100644
--- a/llvm/test/CodeGen/BPF/CORE/anon-union-localvar-pragma.ll
+++ b/llvm/test/CodeGen/BPF/CORE/anon-union-localvar-pragma.ll
@@ -50,7 +50,7 @@ entry:
; CHECK: .long 16 # FieldReloc
; CHECK-NEXT: .long 10 # Field reloc section string offset=10
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp[[#]]
+; CHECK-NEXT: .long Ltmp[[#]]
; CHECK-NEXT: .long 7
; CHECK-NEXT: .long 101
; CHECK-NEXT: .long 1
diff --git a/llvm/test/CodeGen/BPF/CORE/btf-id-duplicate.ll b/llvm/test/CodeGen/BPF/CORE/btf-id-duplicate.ll
index 23a461752e1b8..c23cab4ba8850 100644
--- a/llvm/test/CodeGen/BPF/CORE/btf-id-duplicate.ll
+++ b/llvm/test/CodeGen/BPF/CORE/btf-id-duplicate.ll
@@ -49,11 +49,11 @@ entry:
; CHECK: .long 16 # FieldReloc
; CHECK-NEXT: .long 20 # Field reloc section string offset=20
; CHECK-NEXT: .long 2
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 2
; CHECK-NEXT: .long 26
; CHECK-NEXT: .long 6
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 2
; CHECK-NEXT: .long 26
; CHECK-NEXT: .long 6
diff --git a/llvm/test/CodeGen/BPF/CORE/field-reloc-alu32.ll b/llvm/test/CodeGen/BPF/CORE/field-reloc-alu32.ll
index 40a2432d67850..43f494e10bc81 100644
--- a/llvm/test/CodeGen/BPF/CORE/field-reloc-alu32.ll
+++ b/llvm/test/CodeGen/BPF/CORE/field-reloc-alu32.ll
@@ -34,7 +34,7 @@ entry:
; CHECK: .long 16 # FieldReloc
; CHECK-NEXT: .long 7 # Field reloc section string offset=7
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 4
; CHECK-NEXT: .long 19
; CHECK-NEXT: .long 0
diff --git a/llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-1-bpfeb.ll b/llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-1-bpfeb.ll
index 63a0945edf152..fb5c1db0080c3 100644
--- a/llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-1-bpfeb.ll
+++ b/llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-1-bpfeb.ll
@@ -27,67 +27,67 @@ target triple = "bpfeb"
; Function Attrs: nounwind readnone
define dso_local i32 @test(ptr %arg) local_unnamed_addr #0 !dbg !13 {
; CHECK-ALU64-LABEL: test:
-; CHECK-ALU64: .Ltest$local:
-; CHECK-ALU64-NEXT: .type .Ltest$local,@function
-; CHECK-ALU64-NEXT: .Lfunc_begin0:
+; CHECK-ALU64: Ltest$local:
+; CHECK-ALU64-NEXT: .type Ltest$local,@function
+; CHECK-ALU64-NEXT: Lfunc_begin0:
; CHECK-ALU64-NEXT: .loc 1 11 0 # test.c:11:0
; CHECK-ALU64-NEXT: .cfi_sections .debug_frame
; CHECK-ALU64-NEXT: .cfi_startproc
; CHECK-ALU64-NEXT: # %bb.0: # %entry
; CHECK-ALU64-NEXT: #DEBUG_VALUE: test:arg <- $r1
-; CHECK-ALU64-NEXT: .Ltmp0:
+; CHECK-ALU64-NEXT: Ltmp0:
; CHECK-ALU64-NEXT: r1 = 16
-; CHECK-ALU64-NEXT: .Ltmp1:
-; CHECK-ALU64-NEXT: .Ltmp2:
-; CHECK-ALU64-NEXT: .Ltmp3:
+; CHECK-ALU64-NEXT: Ltmp1:
+; CHECK-ALU64-NEXT: Ltmp2:
+; CHECK-ALU64-NEXT: Ltmp3:
; CHECK-ALU64-NEXT: r0 = 8
-; CHECK-ALU64-NEXT: .Ltmp4:
+; CHECK-ALU64-NEXT: Ltmp4:
; CHECK-ALU64-NEXT: .loc 1 12 69 prologue_end # test.c:12:69
-; CHECK-ALU64-NEXT: .Ltmp5:
-; CHECK-ALU64-NEXT: .Ltmp6:
+; CHECK-ALU64-NEXT: Ltmp5:
+; CHECK-ALU64-NEXT: Ltmp6:
; CHECK-ALU64-NEXT: r0 += r1
-; CHECK-ALU64-NEXT: .Ltmp7:
+; CHECK-ALU64-NEXT: Ltmp7:
; CHECK-ALU64-NEXT: r1 = 45
; CHECK-ALU64-NEXT: .loc 1 13 67 # test.c:13:67
-; CHECK-ALU64-NEXT: .Ltmp8:
+; CHECK-ALU64-NEXT: Ltmp8:
; CHECK-ALU64-NEXT: r0 += r1
; CHECK-ALU64-NEXT: .loc 1 12 3 # test.c:12:3
-; CHECK-ALU64-NEXT: .Ltmp9:
+; CHECK-ALU64-NEXT: Ltmp9:
; CHECK-ALU64-NEXT: exit
-; CHECK-ALU64-NEXT: .Ltmp10:
-; CHECK-ALU64-NEXT: .Ltmp11:
+; CHECK-ALU64-NEXT: Ltmp10:
+; CHECK-ALU64-NEXT: Ltmp11:
;
; CHECK-ALU32-LABEL: test:
-; CHECK-ALU32: .Ltest$local:
-; CHECK-ALU32-NEXT: .type .Ltest$local,@function
-; CHECK-ALU32-NEXT: .Lfunc_begin0:
+; CHECK-ALU32: Ltest$local:
+; CHECK-ALU32-NEXT: .type Ltest$local,@function
+; CHECK-ALU32-NEXT: Lfunc_begin0:
; CHECK-ALU32-NEXT: .loc 1 11 0 # test.c:11:0
; CHECK-ALU32-NEXT: .cfi_sections .debug_frame
; CHECK-ALU32-NEXT: .cfi_startproc
; CHECK-ALU32-NEXT: # %bb.0: # %entry
; CHECK-ALU32-NEXT: #DEBUG_VALUE: test:arg <- $r1
-; CHECK-ALU32-NEXT: .Ltmp0:
+; CHECK-ALU32-NEXT: Ltmp0:
; CHECK-ALU32-NEXT: r1 = 16
-; CHECK-ALU32-NEXT: .Ltmp1:
-; CHECK-ALU32-NEXT: .Ltmp2:
-; CHECK-ALU32-NEXT: .Ltmp3:
+; CHECK-ALU32-NEXT: Ltmp1:
+; CHECK-ALU32-NEXT: Ltmp2:
+; CHECK-ALU32-NEXT: Ltmp3:
; CHECK-ALU32-NEXT: r0 = 8
-; CHECK-ALU32-NEXT: .Ltmp4:
+; CHECK-ALU32-NEXT: Ltmp4:
; CHECK-ALU32-NEXT: .loc 1 12 69 prologue_end # test.c:12:69
-; CHECK-ALU32-NEXT: .Ltmp5:
-; CHECK-ALU32-NEXT: .Ltmp6:
+; CHECK-ALU32-NEXT: Ltmp5:
+; CHECK-ALU32-NEXT: Ltmp6:
; CHECK-ALU32-NEXT: w0 += w1
-; CHECK-ALU32-NEXT: .Ltmp7:
+; CHECK-ALU32-NEXT: Ltmp7:
; CHECK-ALU32-NEXT: r1 = 45
; CHECK-ALU32-NEXT: .loc 1 13 67 # test.c:13:67
-; CHECK-ALU32-NEXT: .Ltmp8:
+; CHECK-ALU32-NEXT: Ltmp8:
; CHECK-ALU32-NEXT: w0 += w1
; CHECK-ALU32-NEXT: # kill: def $w0 killed $w0 killed $r0
; CHECK-ALU32-NEXT: .loc 1 12 3 # test.c:12:3
-; CHECK-ALU32-NEXT: .Ltmp9:
+; CHECK-ALU32-NEXT: Ltmp9:
; CHECK-ALU32-NEXT: exit
-; CHECK-ALU32-NEXT: .Ltmp10:
-; CHECK-ALU32-NEXT: .Ltmp11:
+; CHECK-ALU32-NEXT: Ltmp10:
+; CHECK-ALU32-NEXT: Ltmp11:
entry:
call void @llvm.dbg.value(metadata ptr %arg, metadata !30, metadata !DIExpression()), !dbg !31
%0 = tail call ptr @llvm.preserve.struct.access.index.p0.p0.ss(ptr elementtype(%struct.s) %arg, i32 5, i32 6), !dbg !32, !llvm.preserve.access.index !18
@@ -108,15 +108,15 @@ entry:
; CHECK: .long 16 # FieldReloc
; CHECK-NEXT: .long 89 # Field reloc section string offset=89
; CHECK-NEXT: .long 3
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 2
; CHECK-NEXT: .long 95
; CHECK-NEXT: .long 0
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 2
; CHECK-NEXT: .long 95
; CHECK-NEXT: .long 1
-; CHECK-NEXT: .long .Ltmp{{[0-9]+}}
+; CHECK-NEXT: .long Ltmp{{[0-9]+}}
; CHECK-NEXT: .long 2
; CHECK-NEXT: .long 95
; CHECK-NEXT: .long 4
diff --git a/llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-1.ll b/llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-1.ll
index 33462198eab15..b88cd9223006a 100644
--- a/llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-1.ll
+++ b/llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-1.ll
@@ -27,67 +27,67 @@ target triple = "bpfel"
; Function Attrs: nounwind readnone
define dso_local i32 @test(ptr %arg) local_unnamed_addr #0 !dbg !13 {
; CHECK-ALU64-LABEL: test:
-; CHECK-ALU64: .Ltest$local:
-; CHECK-ALU64-NEXT: .type .Ltest$local,@function
-; CHECK-ALU64-NEXT: .Lfunc_begin0:
+; CHECK-ALU64: Ltest$local:
+; CHECK-ALU64-NEXT: .type Ltest$local,@function
+; CHECK-ALU64-NEXT: Lfunc_begin0:
; CHECK-ALU64-NEXT: .loc 1 11 0 # test.c:11:0
; CHECK-ALU64-NEXT: .cfi_sections .debug_frame
; CHECK-ALU64-NEXT: .cfi_startproc
; CHECK-ALU64-NEXT: # %bb.0: # %entry
;...
[truncated]
|
I now changed the prefix so that for BPF all local labels start with "L" without dot. |
The "quick fix" broke AMDGPU, so I had to add a new BPF mangling mode that uses "L" for private labels. |
wait what ? @eddyz87 @yonghong-song pls take a look. |
While I'm not involved with BPF development, I favor using If |
I'm starting to lean toward ".L" as well, but first would like to understand why "L" is causing issues. |
Ping:) |
1 similar comment
Ping:) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. sorry for delay.
Okay, looks like consensus is to use '.L' prefix for private global prefix and private label prefix. @aengelke could you make the change again? The below should work:
|
No. The current diff changed things to work properly with "L". |
Just want to confirm. @4ast You perfer to use prefix 'L' for all temp labels? |
Yes. As this patch implements it. The issue we had is that those L labels were in symbol table. This patch is fixing that. |
@aengelke This patch does not really work. I downloaded aengelke:bpf-private-label-prefix and build the clang/llvm tools. I hit the following errors:
I then applied the following change,
and compilation can now pass. However, I didn't see L* lables in the symbol table:
If I add '-Wa,-L' in the command line below, the L* labels will be in symbol
So to ensure L* labels in symbol table, one way is to add -Wa,-L in compilation flags. But that requires additional compilation options. So maybe we can find some llvm internal setting which allows bpf target to overwrite in order to enable L* labels in symbol table. I have not poked into llvm internal yet. |
@yonghong-song we're talking past each other. L labels should NOT be in the symbol table. They are private. We had a bug before. |
Okay, looks like current llvm19/llvm20 already do not have L* labels in symbol table. |
#100550 is for For this patch, I hope we use |
are you saying that if we use ".L" then private labels will automatically appear in disasm output and we don't need this extra flag? |
There is a question whether |
well, this two PRs are related. Currently bpf users used to see L* labels in disasm and we have to preserve this behavior. |
@4ast For this ' I was hoping that switch to ".L" will make labels to appear in disasm automatically without extra flag.', the switch to '.L' won't change anything to disasm since with '.L' the labels still not in symbol table. #100550 is the right direction as at least with option --symbolize-operands, the disasm will break basic blocks with labels properly. Without #100550, even with --symbolize-operands, the disasm will display without any labels. But at you mentioned, this is a regression. Previous, 'llvm-objdump -d ...' will be able to disasm with proper labels. Now we need 'llvm-objdump --symbolize-operands -d ...'. That is why I suggest to make '--symbolize-operands' as the default at least for BPF. An option '--no-symbolize-operands' can be added to disable labels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to keep L symbols in symbol table to preserve current disasm behavior.
Once --symbolize-operands becomes a default for objdump we can revisit this diff.
Previously, PrivateLabelPrefix was default-initialized to "L", so basic block labels were added to the symbol table. This seems like an oversight, so use ".L" for all private labels.
I'm not sure whether this is correct. But there's no documentation anywhere that states something else and MCAsmInfo.h documentation states that PrivateLabelPrefix "Defaults to the same as PrivateGlobalPrefix," so this really seems like an oversight. Also, BPF is the only target where private label and global prefixes differ.