Home | History | Annotate | Download | only in NewGVN
      1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
      2 ; RUN: opt < %s -basicaa -newgvn -S | FileCheck %s
      3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
      4 
      5 %struct.foo = type { %struct.wombat.28*, %struct.zot, %struct.wombat.28* }
      6 %struct.zot = type { i64 }
      7 %struct.barney = type <{ %struct.wombat.28*, %struct.wibble, %struct.snork, %struct.quux.4, %struct.snork.10, %struct.ham.16*, %struct.wobble.23*, i32, i8, i8, [2 x i8] }>
      8 %struct.wibble = type { %struct.pluto, %struct.bar }
      9 %struct.pluto = type { %struct.quux }
     10 %struct.quux = type { %struct.eggs }
     11 %struct.eggs = type { %struct.zot.0, %struct.widget }
     12 %struct.zot.0 = type { i8*, i8*, i8* }
     13 %struct.widget = type { %struct.barney.1 }
     14 %struct.barney.1 = type { [8 x i8] }
     15 %struct.bar = type { [3 x %struct.widget] }
     16 %struct.snork = type <{ %struct.wobble, %struct.bar.3, [7 x i8] }>
     17 %struct.wobble = type { %struct.wombat }
     18 %struct.wombat = type { %struct.zot.2 }
     19 %struct.zot.2 = type { %struct.zot.0, %struct.ham }
     20 %struct.ham = type { %struct.barney.1 }
     21 %struct.bar.3 = type { i8 }
     22 %struct.quux.4 = type <{ %struct.quux.5, %struct.snork.9, [7 x i8] }>
     23 %struct.quux.5 = type { %struct.widget.6 }
     24 %struct.widget.6 = type { %struct.spam }
     25 %struct.spam = type { %struct.zot.0, %struct.ham.7 }
     26 %struct.ham.7 = type { %struct.barney.8 }
     27 %struct.barney.8 = type { [24 x i8] }
     28 %struct.snork.9 = type { i8 }
     29 %struct.snork.10 = type <{ %struct.foo.11, %struct.spam.15, [7 x i8] }>
     30 %struct.foo.11 = type { %struct.snork.12 }
     31 %struct.snork.12 = type { %struct.wombat.13 }
     32 %struct.wombat.13 = type { %struct.zot.0, %struct.wibble.14 }
     33 %struct.wibble.14 = type { %struct.barney.8 }
     34 %struct.spam.15 = type { i8 }
     35 %struct.ham.16 = type { %struct.pluto.17, %struct.pluto.17 }
     36 %struct.pluto.17 = type { %struct.bar.18 }
     37 %struct.bar.18 = type { %struct.baz*, %struct.zot.20, %struct.barney.22 }
     38 %struct.baz = type { %struct.wibble.19* }
     39 %struct.wibble.19 = type <{ %struct.baz, %struct.wibble.19*, %struct.baz*, i8, [7 x i8] }>
     40 %struct.zot.20 = type { %struct.ham.21 }
     41 %struct.ham.21 = type { %struct.baz }
     42 %struct.barney.22 = type { %struct.blam }
     43 %struct.blam = type { i64 }
     44 %struct.wobble.23 = type { %struct.spam.24, %struct.barney* }
     45 %struct.spam.24 = type { %struct.bar.25, %struct.zot.26* }
     46 %struct.bar.25 = type <{ i32 (...)**, i8, i8 }>
     47 %struct.zot.26 = type { i32 (...)**, i32, %struct.widget.27* }
     48 %struct.widget.27 = type { %struct.zot.26, %struct.zot.26* }
     49 %struct.wombat.28 = type <{ i32 (...)**, i8, i8, [6 x i8] }>
     50 
     51 ; Function Attrs: norecurse nounwind ssp uwtable
     52 define weak_odr hidden %struct.foo* @quux(%struct.barney* %arg, %struct.wombat.28* %arg1) local_unnamed_addr #0 align 2 {
     53 ; CHECK-LABEL: @quux(
     54 ; CHECK-NEXT:  bb:
     55 ; CHECK-NEXT:    [[TMP:%.*]] = getelementptr inbounds %struct.barney, %struct.barney* %arg, i64 0, i32 3, i32 0, i32 0, i32 0
     56 ; CHECK-NEXT:    [[TMP2:%.*]] = bitcast %struct.spam* [[TMP]] to %struct.foo**
     57 ; CHECK-NEXT:    [[TMP3:%.*]] = load %struct.foo*, %struct.foo** [[TMP2]], align 8, !tbaa !2
     58 ; CHECK-NEXT:    [[TMP4:%.*]] = getelementptr inbounds %struct.barney, %struct.barney* %arg, i64 0, i32 3, i32 0, i32 0, i32 0, i32 0, i32 1
     59 ; CHECK-NEXT:    [[TMP5:%.*]] = bitcast i8** [[TMP4]] to %struct.foo**
     60 ; CHECK-NEXT:    [[TMP6:%.*]] = load %struct.foo*, %struct.foo** [[TMP5]], align 8, !tbaa !7
     61 ; CHECK-NEXT:    [[TMP7:%.*]] = icmp eq %struct.foo* [[TMP3]], [[TMP6]]
     62 ; CHECK-NEXT:    br i1 [[TMP7]], label %bb21, label %bb8
     63 ; CHECK:       bb8:
     64 ; CHECK-NEXT:    br label %bb11
     65 ; CHECK:       bb9:
     66 ; CHECK-NEXT:    [[TMP10:%.*]] = icmp eq %struct.foo* [[TMP18:%.*]], [[TMP6]]
     67 ; CHECK-NEXT:    br i1 [[TMP10]], label %bb19, label %bb11
     68 ; CHECK:       bb11:
     69 ; CHECK-NEXT:    [[TMP12:%.*]] = phi %struct.foo* [ [[TMP17:%.*]], %bb9 ], [ undef, %bb8 ]
     70 ; CHECK-NEXT:    [[TMP13:%.*]] = phi %struct.foo* [ [[TMP18]], %bb9 ], [ [[TMP3]], %bb8 ]
     71 ; CHECK-NEXT:    [[TMP14:%.*]] = getelementptr inbounds %struct.foo, %struct.foo* [[TMP13]], i64 0, i32 0
     72 ; CHECK-NEXT:    [[TMP15:%.*]] = load %struct.wombat.28*, %struct.wombat.28** [[TMP14]], align 8, !tbaa !8
     73 ; CHECK-NEXT:    [[TMP16:%.*]] = icmp eq %struct.wombat.28* [[TMP15]], %arg1
     74 ; CHECK-NEXT:    [[TMP17]] = select i1 [[TMP16]], %struct.foo* [[TMP13]], %struct.foo* [[TMP12]]
     75 ; CHECK-NEXT:    [[TMP18]] = getelementptr inbounds %struct.foo, %struct.foo* [[TMP13]], i64 1
     76 ; CHECK-NEXT:    br i1 [[TMP16]], label %bb19, label %bb9
     77 ; CHECK:       bb19:
     78 ; CHECK-NEXT:    [[TMP20:%.*]] = phi %struct.foo* [ null, %bb9 ], [ [[TMP17]], %bb11 ]
     79 ; CHECK-NEXT:    br label %bb21
     80 ; CHECK:       bb21:
     81 ; CHECK-NEXT:    [[TMP22:%.*]] = phi %struct.foo* [ null, %bb ], [ [[TMP20]], %bb19 ]
     82 ; CHECK-NEXT:    ret %struct.foo* [[TMP22]]
     83 ;
     84 bb:
     85   %tmp = getelementptr inbounds %struct.barney, %struct.barney* %arg, i64 0, i32 3, i32 0, i32 0, i32 0
     86   %tmp2 = bitcast %struct.spam* %tmp to %struct.foo**
     87   %tmp3 = load %struct.foo*, %struct.foo** %tmp2, align 8, !tbaa !2
     88   %tmp4 = getelementptr inbounds %struct.barney, %struct.barney* %arg, i64 0, i32 3, i32 0, i32 0, i32 0, i32 0, i32 1
     89   %tmp5 = bitcast i8** %tmp4 to %struct.foo**
     90   %tmp6 = load %struct.foo*, %struct.foo** %tmp5, align 8, !tbaa !7
     91   %tmp7 = icmp eq %struct.foo* %tmp3, %tmp6
     92   br i1 %tmp7, label %bb21, label %bb8
     93 
     94 bb8:                                              ; preds = %bb
     95   br label %bb11
     96 
     97 bb9:                                              ; preds = %bb11
     98   %tmp10 = icmp eq %struct.foo* %tmp18, %tmp6
     99   br i1 %tmp10, label %bb19, label %bb11
    100 
    101 bb11:                                             ; preds = %bb9, %bb8
    102   %tmp12 = phi %struct.foo* [ %tmp17, %bb9 ], [ undef, %bb8 ]
    103   %tmp13 = phi %struct.foo* [ %tmp18, %bb9 ], [ %tmp3, %bb8 ]
    104   %tmp14 = getelementptr inbounds %struct.foo, %struct.foo* %tmp13, i64 0, i32 0
    105   %tmp15 = load %struct.wombat.28*, %struct.wombat.28** %tmp14, align 8, !tbaa !8
    106   %tmp16 = icmp eq %struct.wombat.28* %tmp15, %arg1
    107   %tmp17 = select i1 %tmp16, %struct.foo* %tmp13, %struct.foo* %tmp12
    108   %tmp18 = getelementptr inbounds %struct.foo, %struct.foo* %tmp13, i64 1
    109   br i1 %tmp16, label %bb19, label %bb9
    110 
    111 bb19:                                             ; preds = %bb11, %bb9
    112   %tmp20 = phi %struct.foo* [ null, %bb9 ], [ %tmp17, %bb11 ]
    113   br label %bb21
    114 
    115 bb21:                                             ; preds = %bb19, %bb
    116   %tmp22 = phi %struct.foo* [ null, %bb ], [ %tmp20, %bb19 ]
    117   ret %struct.foo* %tmp22
    118 }
    119 
    120 attributes #0 = { norecurse nounwind ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
    121 
    122 !llvm.module.flags = !{!0}
    123 !llvm.ident = !{!1}
    124 
    125 !0 = !{i32 1, !"PIC Level", i32 2}
    126 !1 = !{!"clang version 4.0.0 (http://llvm.org/git/clang.git b63fa9e2bb8aac0a80c3e3467991c6b1a4b01e6a) (llvm/trunk 290779)"}
    127 !2 = !{!3, !4, i64 0}
    128 !3 = !{!"_ZTSN4llvm15SmallVectorBaseE", !4, i64 0, !4, i64 8, !4, i64 16}
    129 !4 = !{!"any pointer", !5, i64 0}
    130 !5 = !{!"omnipotent char", !6, i64 0}
    131 !6 = !{!"Simple C++ TBAA"}
    132 !7 = !{!3, !4, i64 8}
    133 !8 = !{!9, !4, i64 0}
    134 !9 = !{!"_ZTSN4llvm9RecordValE", !4, i64 0, !10, i64 8, !4, i64 16}
    135 !10 = !{!"_ZTSN4llvm14PointerIntPairIPNS_5RecTyELj1EbNS_21PointerLikeTypeTraitsIS2_EENS_18PointerIntPairInfoIS2_Lj1ES4_EEEE", !11, i64 0}
    136 !11 = !{!"long", !5, i64 0}
    137