41 lines · plain
1; RUN: opt -passes=constmerge -S < %s | FileCheck %s2; Test which corresponding x and y are merged and that unnamed_addr3; is correctly set.4 5declare void @zed(ptr, ptr)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(ptr, ptr)31 32define i32 @main() {33entry:34 call void @zed(ptr @test1.x, ptr @test1.y)35 call void @zed(ptr @test2.x, ptr @test2.y)36 call void @zed(ptr @test3.x, ptr @test3.y)37 call void @zed(ptr @test4.x, ptr @test4.y)38 ret i32 039}40 41