1 ; RUN: opt -global-merge -global-merge-max-offset=100 -S -o - %s | FileCheck %s
2 ; RUN: opt -passes='global-merge<max-offset=100>' -S -o - %s | FileCheck %s
4 target datalayout = "e-p:64:64"
5 target triple = "x86_64-unknown-linux-gnu"
7 ; CHECK: @_MergedGlobals = private global <{ i32, i32 }> <{ i32 3, i32 3 }>, align 4
9 @a = internal global i32 1
11 @b = internal global i32 2
13 @c = internal global i32 3
15 @d = internal global i32 3
17 @llvm.used = appending global [1 x ptr] [ptr @a], section "llvm.metadata"
18 @llvm.compiler.used = appending global [1 x ptr] [ptr @b], section "llvm.metadata"
21 ; CHECK: load i32, ptr @a
23 ; CHECK: load i32, ptr @b
25 ; CHECK: load i32, ptr @_MergedGlobals
26 %z1 = load i32, ptr @c
27 ; CHECK: load i32, ptr getelementptr inbounds (<{ i32, i32 }>, ptr @_MergedGlobals, i32 0, i32 1)
28 %z2 = load i32, ptr @d