1 ; RUN: opt -passes=loop-simplify,loop-distribute -enable-loop-distribute -S -pass-remarks-missed=loop-distribute \
2 ; RUN: -pass-remarks-analysis=loop-distribute \
3 ; RUN: -pass-remarks-with-hotness < %s 2>&1 | FileCheck %s --check-prefix=HOTNESS
4 ; RUN: opt -passes=loop-simplify,loop-distribute -enable-loop-distribute -S -pass-remarks-missed=loop-distribute \
5 ; RUN: -pass-remarks-analysis=loop-distribute \
6 ; RUN: < %s 2>&1 | FileCheck %s --check-prefix=NO_HOTNESS
8 ; RUN: opt -passes='loop-simplify,require<aa>,loop-distribute' -S -pass-remarks-missed=loop-distribute \
9 ; RUN: -pass-remarks-analysis=loop-distribute \
10 ; RUN: -pass-remarks-with-hotness < %s 2>&1 | FileCheck %s --check-prefix=HOTNESS
11 ; RUN: opt -passes='loop-simplify,require<aa>,loop-distribute' -S -pass-remarks-missed=loop-distribute \
12 ; RUN: -pass-remarks-analysis=loop-distribute \
13 ; RUN: < %s 2>&1 | FileCheck %s --check-prefix=NO_HOTNESS
15 ; This is the input program:
17 ; 1 void forced (char *A, char *B, char *C, int N) {
18 ; 2 #pragma clang loop distribute(enable)
19 ; 3 for(int i = 0; i < N; i++) {
20 ; 4 A[i] = B[i] * C[i];
24 ; HOTNESS: remark: /tmp/t.c:3:3: loop not distributed: use -Rpass-analysis=loop-distribute for more info (hotness: 300)
25 ; HOTNESS: remark: /tmp/t.c:3:3: loop not distributed: memory operations are safe for vectorization (hotness: 300)
26 ; NO_HOTNESS: remark: /tmp/t.c:3:3: loop not distributed: use -Rpass-analysis=loop-distribute for more info{{$}}
27 ; NO_HOTNESS: remark: /tmp/t.c:3:3: loop not distributed: memory operations are safe for vectorization{{$}}
29 define void @forced(ptr %A, ptr %B, ptr %C, i32 %N) !dbg !7 !prof !22 {
31 %cmp12 = icmp sgt i32 %N, 0, !dbg !9
32 br i1 %cmp12, label %ph, label %for.cond.cleanup, !dbg !10, !prof !23
38 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %ph ]
39 %arrayidx = getelementptr inbounds i8, ptr %B, i64 %indvars.iv, !dbg !12
40 %0 = load i8, ptr %arrayidx, align 1, !dbg !12, !tbaa !13
41 %arrayidx2 = getelementptr inbounds i8, ptr %C, i64 %indvars.iv, !dbg !16
42 %1 = load i8, ptr %arrayidx2, align 1, !dbg !16, !tbaa !13
43 %mul = mul i8 %1, %0, !dbg !17
44 %arrayidx6 = getelementptr inbounds i8, ptr %A, i64 %indvars.iv, !dbg !18
45 store i8 %mul, ptr %arrayidx6, align 1, !dbg !19, !tbaa !13
46 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !10
47 %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !10
48 %exitcond = icmp eq i32 %lftr.wideiv, %N, !dbg !10
49 br i1 %exitcond, label %for.cond.cleanup, label %for.body, !dbg !10, !llvm.loop !20, !prof !24
56 !llvm.module.flags = !{!3, !4}
58 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (trunk 267633) (llvm/trunk 267675)", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)
59 !1 = !DIFile(filename: "/tmp/t.c", directory: "/tmp")
61 !3 = !{i32 2, !"Dwarf Version", i32 2}
62 !4 = !{i32 2, !"Debug Info Version", i32 3}
63 !7 = distinct !DISubprogram(name: "forced", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)
64 !8 = !DISubroutineType(types: !2)
65 !9 = !DILocation(line: 3, column: 20, scope: !7)
66 !10 = !DILocation(line: 3, column: 3, scope: !7)
67 !11 = !DILocation(line: 6, column: 1, scope: !7)
68 !12 = !DILocation(line: 4, column: 12, scope: !7)
69 !13 = !{!14, !14, i64 0}
70 !14 = !{!"omnipotent char", !15, i64 0}
71 !15 = !{!"Simple C/C++ TBAA"}
72 !16 = !DILocation(line: 4, column: 19, scope: !7)
73 !17 = !DILocation(line: 4, column: 17, scope: !7)
74 !18 = !DILocation(line: 4, column: 5, scope: !7)
75 !19 = !DILocation(line: 4, column: 10, scope: !7)
76 !20 = distinct !{!20, !21}
77 !21 = !{!"llvm.loop.distribute.enable", i1 true}
78 !22 = !{!"function_entry_count", i64 3}
79 !23 = !{!"branch_weights", i32 2000, i32 1}
80 !24 = !{!"branch_weights", i32 1, i32 99}