Home | History | Annotate | Download | only in ConstantMerge
      1 ; RUN: opt -constmerge %s -S -o - | FileCheck %s
      2 ; Test that in one run var3 is merged into var2 and var1 into var4.
      3 
      4 declare void @zed(%struct.foobar*, %struct.foobar*)
      5 
      6 %struct.foobar = type { i32 }
      7 
      8 @var1 = internal constant %struct.foobar { i32 2 }
      9 @var2 = unnamed_addr constant %struct.foobar { i32 2 }
     10 @var3 = internal constant %struct.foobar { i32 2 }
     11 @var4 = unnamed_addr constant %struct.foobar { i32 2 }
     12 
     13 ; CHECK:      %struct.foobar = type { i32 }
     14 ; CHECK-NOT: @
     15 ; CHECK: @var2 = constant %struct.foobar { i32 2 }
     16 ; CHECK-NEXT: @var4 = constant %struct.foobar { i32 2 }
     17 ; CHECK-NOT: @
     18 ; CHECK: declare void @zed(%struct.foobar*, %struct.foobar*)
     19 
     20 define i32 @main() {
     21 entry:
     22   call void @zed(%struct.foobar* @var1, %struct.foobar* @var2)
     23   call void @zed(%struct.foobar* @var3, %struct.foobar* @var4)
     24   ret i32 0
     25 }
     26 
     27