1 ; RUN: opt -global-merge -global-merge-max-offset=100 -S -o - %s | FileCheck %s
3 target datalayout = "e-p:64:64"
4 target triple = "x86_64-unknown-linux-gnu"
6 ; CHECK: @_MergedGlobals = private global <{ i32, i32 }> <{ i32 3, i32 3 }>, align 4
8 @a = internal global i32 1
10 @b = internal global i32 2
12 @c = internal global i32 3
14 @d = internal global i32 3
16 @llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @a to i8*)], section "llvm.metadata"
17 @llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32* @b to i8*)], section "llvm.metadata"
20 ; CHECK: load i32, i32* @a
21 %x = load i32, i32* @a
22 ; CHECK: load i32, i32* @b
23 %y = load i32, i32* @b
24 ; CHECK: load i32, i32* getelementptr inbounds (<{ i32, i32 }>, <{ i32, i32 }>* @_MergedGlobals, i32 0, i32 0)
25 %z1 = load i32, i32* @c
26 ; CHECK: load i32, i32* getelementptr inbounds (<{ i32, i32 }>, <{ i32, i32 }>* @_MergedGlobals, i32 0, i32 1)
27 %z2 = load i32, i32* @d