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 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
25 target triple = "x86_64-apple-macosx10.11.0"
27 ; HOTNESS: remark: /tmp/t.c:3:3: loop not distributed: use -Rpass-analysis=loop-distribute for more info (hotness: 300)
28 ; HOTNESS: remark: /tmp/t.c:3:3: loop not distributed: memory operations are safe for vectorization (hotness: 300)
29 ; NO_HOTNESS: remark: /tmp/t.c:3:3: loop not distributed: use -Rpass-analysis=loop-distribute for more info{{$}}
30 ; NO_HOTNESS: remark: /tmp/t.c:3:3: loop not distributed: memory operations are safe for vectorization{{$}}
32 define void @forced(ptr %A, ptr %B, ptr %C, i32 %N) !dbg !7 !prof !22 {
34 %cmp12 = icmp sgt i32 %N, 0, !dbg !9
35 br i1 %cmp12, label %ph, label %for.cond.cleanup, !dbg !10, !prof !23
41 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %ph ]
42 %arrayidx = getelementptr inbounds i8, ptr %B, i64 %indvars.iv, !dbg !12
43 %0 = load i8, ptr %arrayidx, align 1, !dbg !12, !tbaa !13
44 %arrayidx2 = getelementptr inbounds i8, ptr %C, i64 %indvars.iv, !dbg !16
45 %1 = load i8, ptr %arrayidx2, align 1, !dbg !16, !tbaa !13
46 %mul = mul i8 %1, %0, !dbg !17
47 %arrayidx6 = getelementptr inbounds i8, ptr %A, i64 %indvars.iv, !dbg !18
48 store i8 %mul, ptr %arrayidx6, align 1, !dbg !19, !tbaa !13
49 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !10
50 %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !10
51 %exitcond = icmp eq i32 %lftr.wideiv, %N, !dbg !10
52 br i1 %exitcond, label %for.cond.cleanup, label %for.body, !dbg !10, !llvm.loop !20, !prof !24
59 !llvm.module.flags = !{!3, !4}
61 !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)
62 !1 = !DIFile(filename: "/tmp/t.c", directory: "/tmp")
64 !3 = !{i32 2, !"Dwarf Version", i32 2}
65 !4 = !{i32 2, !"Debug Info Version", i32 3}
66 !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)
67 !8 = !DISubroutineType(types: !2)
68 !9 = !DILocation(line: 3, column: 20, scope: !7)
69 !10 = !DILocation(line: 3, column: 3, scope: !7)
70 !11 = !DILocation(line: 6, column: 1, scope: !7)
71 !12 = !DILocation(line: 4, column: 12, scope: !7)
72 !13 = !{!14, !14, i64 0}
73 !14 = !{!"omnipotent char", !15, i64 0}
74 !15 = !{!"Simple C/C++ TBAA"}
75 !16 = !DILocation(line: 4, column: 19, scope: !7)
76 !17 = !DILocation(line: 4, column: 17, scope: !7)
77 !18 = !DILocation(line: 4, column: 5, scope: !7)
78 !19 = !DILocation(line: 4, column: 10, scope: !7)
79 !20 = distinct !{!20, !21}
80 !21 = !{!"llvm.loop.distribute.enable", i1 true}
81 !22 = !{!"function_entry_count", i64 3}
82 !23 = !{!"branch_weights", i32 2000, i32 1}
83 !24 = !{!"branch_weights", i32 1, i32 99}