Peter Collingbourne cbea5631a2
GlobalMerge: Do not merge globals with non-dbg metadata.
As noticed during the review of #149260, this transformation
is not necessarily correct for all metadata types.

Reviewers: efriedma-quic

Pull Request: https://github.com/llvm/llvm-project/pull/175875
2026-01-16 11:21:50 -08:00

16 lines
410 B
LLVM

; RUN: opt -global-merge -global-merge-max-offset=100 -S -o - %s | FileCheck %s
; RUN: opt -passes='global-merge<max-offset=100>' -S -o - %s | FileCheck %s
target datalayout = "e-p:64:64"
target triple = "x86_64-unknown-linux-gnu"
; CHECK-NOT: @_MergedGlobals
@a = internal global i32 1
@b = internal global i32 2, !foo !{}
define void @use1() {
%x = load i32, ptr @a
%y = load i32, ptr @b
ret void
}