[llvm] Expand testing for global merge symbol table info on AIX. (PR #224099)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 10:50:04 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-powerpc

Author: Sean Fertile (mandlebug)

<details>
<summary>Changes</summary>

Add a test that checks the symbol table info for merged global symbols when they do not have an explicit section attribute. Uses the option nozero-initialized-in-bss so we get symbol table entiries for the zero initialized globals as well.

---
Full diff: https://github.com/llvm/llvm-project/pull/224099.diff


1 Files Affected:

- (added) llvm/test/CodeGen/PowerPC/global-merge-aix-nosections.ll (+82) 


``````````diff
diff --git a/llvm/test/CodeGen/PowerPC/global-merge-aix-nosections.ll b/llvm/test/CodeGen/PowerPC/global-merge-aix-nosections.ll
new file mode 100644
index 0000000000000..5e1bc8dbbd223
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/global-merge-aix-nosections.ll
@@ -0,0 +1,82 @@
+; RUN: rm -rf %t
+; RUN: mkdir -p %t
+
+; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr8 -nozero-initialized-in-bss < %s | FileCheck %s
+
+; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr8 \
+; RUN:    -nozero-initialized-in-bss --filetype=obj -o %t/global-merge-aix-nosections.o < %s
+; RUN: llvm-objdump --syms %t/global-merge-aix-nosections.o | FileCheck %s --check-prefix=OBJ
+
+%struct.Example = type { i32, i8 }
+
+ at a = internal global i32 1, align 4
+ at b = internal global i32 2, align 4
+ at c = internal global i32 3, align 4
+ at S1 = internal global %struct.Example { i32 4, i8 5 }, align 4
+
+ at y = internal global i32 0, align 4
+ at z = internal global i32 0, align 4
+ at l = internal global i32 0, align 4
+ at u = internal global i16 0, align 2
+ at S2 = internal global %struct.Example zeroinitializer, align 4
+
+define void @g() {
+entry:
+  call void @escape(ptr noundef nonnull @a)
+  call void @escape(ptr noundef nonnull @b)
+  call void @escape(ptr noundef nonnull @c)
+  call void @escape(ptr noundef nonnull @S1)
+  call void @escape(ptr noundef nonnull @y)
+  call void @escape(ptr noundef nonnull @z)
+  call void @escape(ptr noundef nonnull @l)
+  call void @escape(ptr noundef nonnull @u)
+  call void @escape(ptr noundef nonnull @S2)
+  ret void
+}
+
+declare void @escape(ptr noundef)
+
+; CHECK:        .csect L.._MergedGlobals[RW],2
+; CHECK-NEXT:   .lglobl u
+; CHECK-NEXT:   .lglobl a
+; CHECK-NEXT:   .lglobl b
+; CHECK-NEXT:   .lglobl c
+; CHECK-NEXT:   .lglobl y
+; CHECK-NEXT:   .lglobl z
+; CHECK-NEXT:   .lglobl l
+; CHECK-NEXT:   .lglobl S1
+; CHECK-NEXT:   .lglobl S2
+; CHECK-NEXT:   .align  2
+; CHECK-NEXT: u:
+; CHECK-NEXT:   .vbyte  2, 0
+; CHECK-NEXT:   .space  2
+; CHECK-NEXT: a:
+; CHECK-NEXT:   .vbyte  4, 1
+; CHECK-NEXT: b:
+; CHECK-NEXT:   .vbyte  4, 2
+; CHECK-NEXT: c:
+; CHECK-NEXT:   .vbyte  4, 3
+; CHECK-NEXT: y:
+; CHECK-NEXT:   .vbyte  4, 0
+; CHECK-NEXT: z:
+; CHECK-NEXT:   .vbyte  4, 0
+; CHECK-NEXT: l:
+; CHECK-NEXT:   .vbyte  4, 0
+; CHECK-NEXT: S1:
+; CHECK-NEXT:   .vbyte  4, 4
+; CHECK-NEXT:   .byte   5
+; CHECK-NEXT:   .space  3
+; CHECK-NEXT: S2:
+; CHECK-NEXT:   .space  4
+; CHECK-NEXT:   .space  4
+
+; OBJ:      00000000000000ac l     O .data  000000000000002c L.._MergedGlobals
+; OBJ-NEXT: 00000000000000ac l     O .data (csect: L.._MergedGlobals)       0000000000000000 u
+; OBJ-NEXT: 00000000000000b0 l     O .data (csect: L.._MergedGlobals)       0000000000000000 a
+; OBJ-NEXT: 00000000000000b4 l     O .data (csect: L.._MergedGlobals)       0000000000000000 b
+; OBJ-NEXT: 00000000000000b8 l     O .data (csect: L.._MergedGlobals)       0000000000000000 c
+; OBJ-NEXT: 00000000000000bc l     O .data (csect: L.._MergedGlobals)       0000000000000000 y
+; OBJ-NEXT: 00000000000000c0 l     O .data (csect: L.._MergedGlobals)       0000000000000000 z
+; OBJ-NEXT: 00000000000000c4 l     O .data (csect: L.._MergedGlobals)       0000000000000000 l
+; OBJ-NEXT: 00000000000000c8 l     O .data (csect: L.._MergedGlobals)       0000000000000000 S1
+; OBJ-NEXT: 00000000000000d0 l     O .data (csect: L.._MergedGlobals)       0000000000000000 S2

``````````

</details>


https://github.com/llvm/llvm-project/pull/224099


More information about the llvm-commits mailing list