1 ; RUN: opt %s -S -scoped-noalias -enable-mssa-loop-dependency=true -licm | FileCheck %s
3 define i16 @main(i1 %a_b_mayalias, i16* %a, i16* %b) {
5 ; CHECK-NEXT: [[J:%.*]] = phi i64
6 ; CHECK-NEXT: [[TMP3:%.*]] = load i16
7 ; CHECK-NEXT: [[RESULT:%.*]] = add i16 [[TMP3]], 1
8 ; CHECK-NEXT: store i16 [[RESULT]]
13 outer: ; preds = %scalar.cleanup, %entry
14 ; 4 = MemoryPhi({entry,liveOnEntry},{scalar.cleanup,2})
15 %i = phi i16 [ 0, %entry ], [ %i.next, %scalar.cleanup ]
16 br i1 %a_b_mayalias, label %scalar.ph, label %vector.ph
18 vector.ph: ; preds = %outer
19 ; MemoryUse(4) MayAlias
20 %tmp1 = load i16, i16* %a, align 1, !alias.scope !0, !tbaa !7
21 %tmp2 = add i16 %tmp1, 1
23 store i16 %tmp2, i16* %b, align 1, !alias.scope !3, !noalias !0, !tbaa !7
26 vector.body: ; preds = %vector.body, %vector.ph
27 %index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.ph ]
28 %index.next = add i64 %index, 1
29 %cmp1 = icmp eq i64 %index.next, 16
30 br i1 %cmp1, label %middle.block, label %vector.body
32 middle.block: ; preds = %vector.body
35 scalar.ph: ; preds = %middle.block, %outer
36 ; 5 = MemoryPhi({outer,4},{middle.block,1})
37 %j.start = phi i64 [ 0, %outer ], [ 16, %middle.block ]
40 scalar.body: ; preds = %scalar.body, %scalar.ph
41 ; 3 = MemoryPhi({scalar.ph,5},{scalar.body,2})
42 %j = phi i64 [ %j.next, %scalar.body ], [ %j.start, %scalar.ph ]
43 ; MemoryUse(3) MayAlias
44 %tmp3 = load i16, i16* %a, align 1, !tbaa !7
45 %result = add i16 %tmp3, 1
47 store i16 %result, i16* %b, align 1, !tbaa !7
48 %j.next = add nuw nsw i64 %j, 1
49 %cmp2 = icmp ult i64 %j.next, 20
50 br i1 %cmp2, label %scalar.body, label %scalar.cleanup
52 scalar.cleanup: ; preds = %scalar.body
53 %result.lcssa = phi i16 [ %result, %scalar.body ]
54 %i.next = add nuw nsw i16 %i, 1
55 %exitcond = icmp eq i16 %i.next, 10
56 br i1 %exitcond, label %exit.block, label %outer
58 exit.block: ; preds = %scalar.cleanup
59 %result.lcssa.lcssa = phi i16 [ %result.lcssa, %scalar.cleanup ]
60 ret i16 %result.lcssa.lcssa
64 !1 = distinct !{!1, !2}
65 !2 = distinct !{!2, !"LVerDomain"}
67 !4 = distinct !{!4, !2}
68 !5 = !{!"Simple C++ TBAA"}
69 !6 = !{!"omnipotent char", !5, i64 0}