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