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