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