Home | History | Annotate | Download | only in AliasSet
      1 ; RUN: opt -basicaa -print-alias-sets -S -o - < %s 2>&1 | FileCheck %s
      2 
      3 @s = global i8 1, align 1
      4 @d = global i8 2, align 1
      5 
      6 ; CHECK: Alias sets for function 'test1':
      7 ; CHECK: Alias Set Tracker: 3 alias sets for 4 pointer values.
      8 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %a, 1)
      9 ; CHECK-NOT:    1 Unknown instructions
     10 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 2] may alias, Mod/Ref   Pointers: (i8* %s, 1), (i8* %d, 1)
     11 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %b, 1)
     12 define void @test1(i8* %s, i8* %d) {
     13 entry:
     14   %a = alloca i8, align 1
     15   %b = alloca i8, align 1
     16   store i8 1, i8* %a, align 1
     17   call void @llvm.memcpy.p0i8.p0i8.i64(i8* %d, i8* %s, i64 1, i1 false)
     18   store i8 1, i8* %b, align 1
     19   ret void
     20 }
     21 
     22 ; CHECK: Alias sets for function 'test1_atomic':
     23 ; CHECK: Alias Set Tracker: 3 alias sets for 4 pointer values.
     24 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %a, 1)
     25 ; CHECK-NOT:    1 Unknown instructions
     26 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 2] may alias, Mod/Ref   Pointers: (i8* %s, 1), (i8* %d, 1)
     27 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %b, 1)
     28 define void @test1_atomic(i8* %s, i8* %d) {
     29 entry:
     30   %a = alloca i8, align 1
     31   %b = alloca i8, align 1
     32   store atomic i8 1, i8* %a unordered, align 1
     33   call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %d, i8* align 1 %s, i64 1, i32 1)
     34   store atomic i8 1, i8* %b unordered, align 1
     35   ret void
     36 }
     37 
     38 ; CHECK: Alias sets for function 'test2':
     39 ; CHECK: Alias Set Tracker: 3 alias sets for 4 pointer values.
     40 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %a, 1)
     41 ; CHECK-NOT:    1 Unknown instructions
     42 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 2] may alias, Mod/Ref   [volatile] Pointers: (i8* %s, 1), (i8* %d, 1)
     43 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %b, 1)
     44 define void @test2(i8* %s, i8* %d) {
     45 entry:
     46   %a = alloca i8, align 1
     47   %b = alloca i8, align 1
     48   store i8 1, i8* %a, align 1
     49   call void @llvm.memcpy.p0i8.p0i8.i64(i8* %d, i8* %s, i64 1, i1 true)
     50   store i8 1, i8* %b, align 1
     51   ret void
     52 }
     53 
     54 ; CHECK: Alias sets for function 'test3':
     55 ; CHECK: Alias Set Tracker: 3 alias sets for 4 pointer values.
     56 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %a, 1)
     57 ; CHECK-NOT:    1 Unknown instructions
     58 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 2] may alias, Mod/Ref   Pointers: (i8* %s, 1), (i8* %d, 1)
     59 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %b, 1)
     60 define void @test3(i8* %s, i8* %d) {
     61 entry:
     62   %a = alloca i8, align 1
     63   %b = alloca i8, align 1
     64   store i8 1, i8* %a, align 1
     65   call void @llvm.memmove.p0i8.p0i8.i64(i8* %d, i8* %s, i64 1, i1 false)
     66   store i8 1, i8* %b, align 1
     67   ret void
     68 }
     69 
     70 ; CHECK: Alias sets for function 'test3_atomic':
     71 ; CHECK: Alias Set Tracker: 3 alias sets for 4 pointer values.
     72 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %a, 1)
     73 ; CHECK-NOT:    1 Unknown instructions
     74 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 2] may alias, Mod/Ref   Pointers: (i8* %s, 1), (i8* %d, 1)
     75 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %b, 1)
     76 define void @test3_atomic(i8* %s, i8* %d) {
     77 entry:
     78   %a = alloca i8, align 1
     79   %b = alloca i8, align 1
     80   store atomic i8 1, i8* %a unordered, align 1
     81   call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %d, i8* align 1 %s, i64 1, i32 1)
     82   store atomic i8 1, i8* %b unordered, align 1
     83   ret void
     84 }
     85 
     86 ; CHECK: Alias sets for function 'test4':
     87 ; CHECK: Alias Set Tracker: 3 alias sets for 4 pointer values.
     88 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %a, 1)
     89 ; CHECK-NOT:    1 Unknown instructions
     90 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 2] may alias, Mod/Ref   [volatile] Pointers: (i8* %s, 1), (i8* %d, 1)
     91 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %b, 1)
     92 define void @test4(i8* %s, i8* %d) {
     93 entry:
     94   %a = alloca i8, align 1
     95   %b = alloca i8, align 1
     96   store i8 1, i8* %a, align 1
     97   call void @llvm.memmove.p0i8.p0i8.i64(i8* %d, i8* %s, i64 1, i1 true)
     98   store i8 1, i8* %b, align 1
     99   ret void
    100 }
    101 
    102 ; CHECK: Alias sets for function 'test5':
    103 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
    104 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref   Pointers: (i8* %a, 1)
    105 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %b, 1)
    106 define void @test5() {
    107 entry:
    108   %a = alloca i8, align 1
    109   %b = alloca i8, align 1
    110   store i8 1, i8* %a, align 1
    111   call void @llvm.memcpy.p0i8.p0i8.i64(i8* %b, i8* %a, i64 1, i1 false)
    112   store i8 1, i8* %b, align 1
    113   ret void
    114 }
    115 
    116 ; CHECK: Alias sets for function 'test5_atomic':
    117 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
    118 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref   Pointers: (i8* %a, 1)
    119 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %b, 1)
    120 define void @test5_atomic() {
    121 entry:
    122   %a = alloca i8, align 1
    123   %b = alloca i8, align 1
    124   store atomic i8 1, i8* %a unordered, align 1
    125   call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %b, i8* align 1 %a, i64 1, i32 1)
    126   store atomic i8 1, i8* %b unordered, align 1
    127   ret void
    128 }
    129 
    130 ; CHECK: Alias sets for function 'test6':
    131 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
    132 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref   Pointers: (i8* %a, 1)
    133 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %b, 1)
    134 define void @test6() {
    135 entry:
    136   %a = alloca i8, align 1
    137   %b = alloca i8, align 1
    138   store i8 1, i8* %a, align 1
    139   call void @llvm.memmove.p0i8.p0i8.i64(i8* %b, i8* %a, i64 1, i1 false)
    140   store i8 1, i8* %b, align 1
    141   ret void
    142 }
    143 
    144 ; CHECK: Alias sets for function 'test6_atomic':
    145 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
    146 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref   Pointers: (i8* %a, 1)
    147 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod       Pointers: (i8* %b, 1)
    148 define void @test6_atomic() {
    149 entry:
    150   %a = alloca i8, align 1
    151   %b = alloca i8, align 1
    152   store atomic i8 1, i8* %a unordered, align 1
    153   call void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %b, i8* align 1 %a, i64 1, i32 1)
    154   store atomic i8 1, i8* %b unordered, align 1
    155   ret void
    156 }
    157 
    158 ; CHECK: Alias sets for function 'test7':
    159 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
    160 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref   Pointers: (i8* %a, 1)
    161 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref   Pointers: (i8* %b, 1)
    162 define void @test7() {
    163 entry:
    164   %a = alloca i8, align 1
    165   %b = alloca i8, align 1
    166   store i8 1, i8* %a, align 1
    167   call void @llvm.memcpy.p0i8.p0i8.i64(i8* %b, i8* %a, i64 1, i1 false)
    168   call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* %b, i64 1, i1 false)
    169   store i8 1, i8* %b, align 1
    170   ret void
    171 }
    172 
    173 ; CHECK: Alias sets for function 'test7_atomic':
    174 ; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values.
    175 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref   Pointers: (i8* %a, 1)
    176 ; CHECK:   AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod/Ref   Pointers: (i8* %b, 1)
    177 define void @test7_atomic() {
    178 entry:
    179   %a = alloca i8, align 1
    180   %b = alloca i8, align 1
    181   store atomic i8 1, i8* %a unordered, align 1
    182   call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %b, i8* align 1 %a, i64 1, i32 1)
    183   call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %a, i8* align 1 %b, i64 1, i32 1)
    184   store atomic i8 1, i8* %b unordered, align 1
    185   ret void
    186 }
    187 
    188 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)
    189 declare void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32)
    190 declare void @llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1)
    191 declare void @llvm.memmove.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32)
    192