1; RUN: opt -constmerge -S < %s | FileCheck %s 2; Test that in one run var3 is merged into var2 and var1 into var4. 3; Test that we merge @var5 and @var6 into one with the higher alignment, and 4; don't merge var7/var8 into var5/var6. 5 6declare void @zed(%struct.foobar*, %struct.foobar*) 7 8%struct.foobar = type { i32 } 9 10@var1 = internal constant %struct.foobar { i32 2 } 11@var2 = unnamed_addr constant %struct.foobar { i32 2 } 12@var3 = internal constant %struct.foobar { i32 2 } 13@var4 = unnamed_addr constant %struct.foobar { i32 2 } 14 15; CHECK: %struct.foobar = type { i32 } 16; CHECK-NOT: @ 17; CHECK: @var2 = constant %struct.foobar { i32 2 } 18; CHECK-NEXT: @var4 = constant %struct.foobar { i32 2 } 19 20declare void @helper([16 x i8]*) 21@var5 = internal constant [16 x i8] c"foo1bar2foo3bar\00", align 16 22@var6 = private unnamed_addr constant [16 x i8] c"foo1bar2foo3bar\00", align 1 23@var7 = internal constant [16 x i8] c"foo1bar2foo3bar\00" 24@var8 = private unnamed_addr constant [16 x i8] c"foo1bar2foo3bar\00" 25 26; CHECK-NEXT: @var6 = private constant [16 x i8] c"foo1bar2foo3bar\00", align 16 27; CHECK-NEXT: @var8 = private constant [16 x i8] c"foo1bar2foo3bar\00" 28 29@var4a = alias %struct.foobar* @var4 30@llvm.used = appending global [1 x %struct.foobar*] [%struct.foobar* @var4a], section "llvm.metadata" 31 32define i32 @main() { 33entry: 34 call void @zed(%struct.foobar* @var1, %struct.foobar* @var2) 35 call void @zed(%struct.foobar* @var3, %struct.foobar* @var4) 36 call void @helper([16 x i8]* @var5) 37 call void @helper([16 x i8]* @var6) 38 call void @helper([16 x i8]* @var7) 39 call void @helper([16 x i8]* @var8) 40 ret i32 0 41} 42 43