unnamed-addr.ll 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. declare void @zed(%struct.foobar*, %struct.foobar*)
  5. %struct.foobar = type { i32 }
  6. @test1.x = internal constant %struct.foobar { i32 1 }
  7. @test1.y = constant %struct.foobar { i32 1 }
  8. @test2.x = internal constant %struct.foobar { i32 2 }
  9. @test2.y = unnamed_addr constant %struct.foobar { i32 2 }
  10. @test3.x = internal unnamed_addr constant %struct.foobar { i32 3 }
  11. @test3.y = constant %struct.foobar { i32 3 }
  12. @test4.x = internal unnamed_addr constant %struct.foobar { i32 4 }
  13. @test4.y = unnamed_addr constant %struct.foobar { i32 4 }
  14. ; CHECK: %struct.foobar = type { i32 }
  15. ; CHECK-NOT: @
  16. ; CHECK: @test1.x = internal constant %struct.foobar { i32 1 }
  17. ; CHECK-NEXT: @test1.y = constant %struct.foobar { i32 1 }
  18. ; CHECK-NEXT: @test2.y = constant %struct.foobar { i32 2 }
  19. ; CHECK-NEXT: @test3.y = constant %struct.foobar { i32 3 }
  20. ; CHECK-NEXT: @test4.y = unnamed_addr constant %struct.foobar { i32 4 }
  21. ; CHECK-NOT: @
  22. ; CHECK: declare void @zed(%struct.foobar*, %struct.foobar*)
  23. define i32 @main() {
  24. entry:
  25. call void @zed(%struct.foobar* @test1.x, %struct.foobar* @test1.y)
  26. call void @zed(%struct.foobar* @test2.x, %struct.foobar* @test2.y)
  27. call void @zed(%struct.foobar* @test3.x, %struct.foobar* @test3.y)
  28. call void @zed(%struct.foobar* @test4.x, %struct.foobar* @test4.y)
  29. ret i32 0
  30. }