dont-merge.ll 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ; RUN: opt < %s -constmerge -S | FileCheck %s
  2. ; Don't merge constants with specified sections.
  3. @T1G1 = internal constant i32 1, section "foo"
  4. @T1G2 = internal constant i32 1, section "bar"
  5. @T1G3 = internal constant i32 1, section "bar"
  6. ; CHECK: @T1G1
  7. ; CHECK: @T1G2
  8. ; CHECK: @T1G3
  9. define void @test1(i32** %P1, i32** %P2, i32** %P3) {
  10. store i32* @T1G1, i32** %P1
  11. store i32* @T1G2, i32** %P2
  12. store i32* @T1G3, i32** %P3
  13. ret void
  14. }
  15. @T2a = internal constant i32 224
  16. @T2b = internal addrspace(30) constant i32 224
  17. ; CHECK: @T2a
  18. ; CHECK: @T2b
  19. define void @test2(i32** %P1, i32 addrspace(30)** %P2) {
  20. store i32* @T2a, i32** %P1
  21. store i32 addrspace(30)* @T2b, i32 addrspace(30)** %P2
  22. ret void
  23. }
  24. ; PR8144 - Don't merge globals marked attribute(used)
  25. ; CHECK: @T3A =
  26. ; CHECK: @T3B =
  27. @T3A = internal constant i32 0
  28. @T3B = internal constant i32 0
  29. @llvm.used = appending global [2 x i32*] [i32* @T3A, i32* @T3B], section
  30. "llvm.metadata"
  31. define void @test3() {
  32. call void asm sideeffect "T3A, T3B",""() ; invisible use of T3A and T3B
  33. ret void
  34. }