[GlobalMerge][PPC] Don't merge globals in llvm.metadata section (#131… · llvm/llvm-project@78f6719 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit 78f6719

nikictstellar

authored and

committed

[GlobalMerge][PPC] Don't merge globals in llvm.metadata section (#131801)

The llvm.metadata section is not emitted and has special semantics. We should not merge globals in it, similarly to how we already skip merging of `llvm.xyz` globals.Fixes #131394. (cherry picked from commit 9356091)

File tree

2 files changed

lines changed

2 files changed

lines changed

Lines changed: 2 additions & 1 deletion

Original file line number Diff line number Diff line change
@@ -711,7 +711,8 @@ bool GlobalMergeImpl::run(Module &M) {
711 711 continue;
712 712
713 713 // Ignore all 'special' globals.
714 -if (GV.getName().starts_with("llvm.") |
714 +if (GV.getName().starts_with("llvm.") |
715 + GV.getName().starts_with(".llvm.") |
715 716 continue;
716 717
717 718 // Ignore all "required" globals:

Lines changed: 9 additions & 0 deletions

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
1 +; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s
2 +
3 +@index = global i32 0, align 4
4 +@.str = private unnamed_addr constant [1 x i8] zeroinitializer, section "llvm.metadata"
5 +@.str.1 = private unnamed_addr constant [7 x i8] c"test.c\00", section "llvm.metadata"
6 +@llvm.global.annotations = appending global [1 x { ptr, ptr, ptr, i32, ptr }] [{ ptr, ptr, ptr, i32, ptr } { ptr @index, ptr @.str, ptr @.str.1, i32 1, ptr null }], section "llvm.metadata"
7 +
8 +; CHECK-NOT: .set
9 +; CHECK-NOT: _MergedGlobals