1*9880d681SAndroid Build Coastguard Worker; RUN: opt -constmerge -S < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker; Test which corresponding x and y are merged and that unnamed_addr 3*9880d681SAndroid Build Coastguard Worker; is correctly set. 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Workerdeclare void @zed(%struct.foobar*, %struct.foobar*) 6*9880d681SAndroid Build Coastguard Worker 7*9880d681SAndroid Build Coastguard Worker%struct.foobar = type { i32 } 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Worker@test1.x = internal constant %struct.foobar { i32 1 } 10*9880d681SAndroid Build Coastguard Worker@test1.y = constant %struct.foobar { i32 1 } 11*9880d681SAndroid Build Coastguard Worker 12*9880d681SAndroid Build Coastguard Worker@test2.x = internal constant %struct.foobar { i32 2 } 13*9880d681SAndroid Build Coastguard Worker@test2.y = unnamed_addr constant %struct.foobar { i32 2 } 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Worker@test3.x = internal unnamed_addr constant %struct.foobar { i32 3 } 16*9880d681SAndroid Build Coastguard Worker@test3.y = constant %struct.foobar { i32 3 } 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Worker@test4.x = internal unnamed_addr constant %struct.foobar { i32 4 } 19*9880d681SAndroid Build Coastguard Worker@test4.y = unnamed_addr constant %struct.foobar { i32 4 } 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard Worker; CHECK: %struct.foobar = type { i32 } 23*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: @ 24*9880d681SAndroid Build Coastguard Worker; CHECK: @test1.x = internal constant %struct.foobar { i32 1 } 25*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: @test1.y = constant %struct.foobar { i32 1 } 26*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: @test2.y = constant %struct.foobar { i32 2 } 27*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: @test3.y = constant %struct.foobar { i32 3 } 28*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: @test4.y = unnamed_addr constant %struct.foobar { i32 4 } 29*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: @ 30*9880d681SAndroid Build Coastguard Worker; CHECK: declare void @zed(%struct.foobar*, %struct.foobar*) 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Workerdefine i32 @main() { 33*9880d681SAndroid Build Coastguard Workerentry: 34*9880d681SAndroid Build Coastguard Worker call void @zed(%struct.foobar* @test1.x, %struct.foobar* @test1.y) 35*9880d681SAndroid Build Coastguard Worker call void @zed(%struct.foobar* @test2.x, %struct.foobar* @test2.y) 36*9880d681SAndroid Build Coastguard Worker call void @zed(%struct.foobar* @test3.x, %struct.foobar* @test3.y) 37*9880d681SAndroid Build Coastguard Worker call void @zed(%struct.foobar* @test4.x, %struct.foobar* @test4.y) 38*9880d681SAndroid Build Coastguard Worker ret i32 0 39*9880d681SAndroid Build Coastguard Worker} 40*9880d681SAndroid Build Coastguard Worker 41