1 ; RUN: opt %loadNPMPolly -polly-stmt-granularity=scalar-indep -polly-print-instructions '-passes=print<polly-function-scops>' -disable-output < %s 2>&1 | FileCheck %s -match-full-lines
3 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
5 @b = dso_local local_unnamed_addr global i32 1, align 4
6 @e = dso_local local_unnamed_addr global i32 3, align 4
7 @a = common dso_local local_unnamed_addr global [56 x i32] zeroinitializer, align 16
8 @f = common dso_local local_unnamed_addr global i16 0, align 2
9 @d = common dso_local local_unnamed_addr global i8 0, align 1
11 ; Function Attrs: nounwind uwtable
12 define dso_local i32 @func() {
16 entry.split: ; preds = %entry
19 for.body: ; preds = %for.body, %entry.split
20 %indvars.iv = phi i64 [ 0, %entry.split ], [ %indvars.iv.next, %for.body ]
21 %arrayidx = getelementptr inbounds [56 x i32], ptr @a, i64 0, i64 %indvars.iv
22 %0 = trunc i64 %indvars.iv to i32
23 store i32 %0, ptr %arrayidx, align 4, !tbaa !0
24 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
25 %exitcond = icmp eq i64 %indvars.iv.next, 56
26 br i1 %exitcond, label %for.end, label %for.body
28 for.end: ; preds = %for.body
29 %1 = load i32, ptr @e, align 4, !tbaa !0
30 store i32 2, ptr @e, align 4, !tbaa !0
31 %2 = trunc i32 %1 to i16
33 %tobool = icmp eq i16 %conv, 0
36 for.body3: ; preds = %for.end, %for.inc11
37 %storemerge20 = phi i32 [ 2, %for.end ], [ %dec12, %for.inc11 ]
38 %3 = load i8, ptr @d, align 1
39 %cmp6 = icmp eq i8 %3, 8
40 %or.cond = or i1 %tobool, %cmp6
41 br i1 %or.cond, label %for.inc11, label %for.inc11.loopexit
43 for.inc11.loopexit: ; preds = %for.body3
44 store i32 0, ptr @b, align 4, !tbaa !0
45 store i8 8, ptr @d, align 1, !tbaa !4
48 for.inc11: ; preds = %for.inc11.loopexit, %for.body3
49 %dec12 = add nsw i32 %storemerge20, -1
50 %cmp2 = icmp sgt i32 %storemerge20, -18
51 br i1 %cmp2, label %for.body3, label %for.end13
53 for.end13: ; preds = %for.inc11
54 store i16 %conv, ptr @f, align 2, !tbaa !5
55 store i32 -19, ptr @e, align 4, !tbaa !0
56 %4 = load i32, ptr @b, align 4, !tbaa !0
61 !1 = !{!"int", !2, i64 0}
62 !2 = !{!"omnipotent char", !3, i64 0}
63 !3 = !{!"Simple C/C++ TBAA"}
66 !6 = !{!"short", !2, i64 0}
68 ; CHECK: Stmt_for_end_a
69 ; CHECK-NEXT: Domain :=
70 ; CHECK-NEXT: { Stmt_for_end_a[] };
71 ; CHECK-NEXT: Schedule :=
72 ; CHECK-NEXT: { Stmt_for_end_a[] -> [1, 0] };
73 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
74 ; CHECK-NEXT: { Stmt_for_end_a[] -> MemRef_e[0] };
75 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
76 ; CHECK-NEXT: { Stmt_for_end_a[] -> MemRef_tobool[] };
77 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
78 ; CHECK-NEXT: { Stmt_for_end_a[] -> MemRef_conv[] };
79 ; CHECK-NEXT: Instructions {
80 ; CHECK-NEXT: %1 = load i32, ptr @e, align 4, !tbaa !0
81 ; CHECK-NEXT: %2 = trunc i32 %1 to i16
82 ; CHECK-NEXT: %conv = and i16 %2, 1
83 ; CHECK-NEXT: %tobool = icmp eq i16 %conv, 0
85 ; CHECK-NEXT: Stmt_for_end
86 ; CHECK-NEXT: Domain :=
87 ; CHECK-NEXT: { Stmt_for_end[] };
88 ; CHECK-NEXT: Schedule :=
89 ; CHECK-NEXT: { Stmt_for_end[] -> [2, 0] };
90 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
91 ; CHECK-NEXT: { Stmt_for_end[] -> MemRef_e[0] };
92 ; CHECK-NEXT: Instructions {
93 ; CHECK-NEXT: store i32 2, ptr @e, align 4, !tbaa !0