1; RUN: opt -constmerge %s -S -o - | 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 29define i32 @main() { 30entry: 31 call void @zed(%struct.foobar* @var1, %struct.foobar* @var2) 32 call void @zed(%struct.foobar* @var3, %struct.foobar* @var4) 33 call void @helper([16 x i8]* @var5) 34 call void @helper([16 x i8]* @var6) 35 call void @helper([16 x i8]* @var7) 36 call void @helper([16 x i8]* @var8) 37 ret i32 0 38} 39 40