xref: /llvm-project/llvm/test/Other/optimization-remarks-lazy-bfi.ll (revision 38386b4318e3ba54f450480ad49b237a9c357af4)
1; Check that BFI is not computed when -pass-remarks-with-hotness is off
2
3; RUN: opt -passes='require<aa>,loop-distribute' -S -pass-remarks-missed=loop-distribute \
4; RUN:     -debug-only=block-freq,branch-prob -pass-remarks-with-hotness \
5; RUN:     < %s 2>&1 | FileCheck %s --check-prefix=HOTNESS
6; RUN: opt -passes='require<aa>,loop-distribute' -S -pass-remarks-missed=loop-distribute \
7; RUN:     -debug-only=block-freq,branch-prob \
8; RUN:     < %s 2>&1 | FileCheck %s --check-prefix=NO_HOTNESS
9
10; REQUIRES: asserts
11
12; HOTNESS: Branch Probability Info : forced
13; HOTNESS: block-frequency: forced
14; NO_HOTNESS-NOT: Branch Probability Info : forced
15; NO_HOTNESS-NOT: block-frequency: forced
16
17; This is the input program:
18;
19;     1	void forced (char *A, char *B, char *C, int N) {
20;     2	#pragma clang loop distribute(enable)
21;     3	  for(int i = 0; i < N; i++) {
22;     4	    A[i] = Bptr C[i];
23;     5	  }
24;     6	}
25
26target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
27target triple = "x86_64-apple-macosx10.11.0"
28
29
30define void @forced(ptr %A, ptr %B, ptr %C, i32 %N) !dbg !7 !prof !22 {
31entry:
32  %cmp12 = icmp sgt i32 %N, 0, !dbg !9
33  br i1 %cmp12, label %ph, label %for.cond.cleanup, !dbg !10, !prof !23
34
35ph:
36  br label %for.body
37
38for.body:
39  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %ph ]
40  %arrayidx = getelementptr inbounds i8, ptr %B, i64 %indvars.iv, !dbg !12
41  %0 = load i8, ptr %arrayidx, align 1, !dbg !12, !tbaa !13
42  %arrayidx2 = getelementptr inbounds i8, ptr %C, i64 %indvars.iv, !dbg !16
43  %1 = load i8, ptr %arrayidx2, align 1, !dbg !16, !tbaa !13
44  %mul = mul i8 %1, %0, !dbg !17
45  %arrayidx6 = getelementptr inbounds i8, ptr %A, i64 %indvars.iv, !dbg !18
46  store i8 %mul, ptr %arrayidx6, align 1, !dbg !19, !tbaa !13
47  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !10
48  %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !10
49  %exitcond = icmp eq i32 %lftr.wideiv, %N, !dbg !10
50  br i1 %exitcond, label %for.cond.cleanup, label %for.body, !dbg !10, !llvm.loop !20, !prof !24
51
52for.cond.cleanup:
53  ret void, !dbg !11
54}
55
56!llvm.dbg.cu = !{!0}
57!llvm.module.flags = !{!3, !4}
58
59!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)
60!1 = !DIFile(filename: "/tmp/t.c", directory: "/tmp")
61!2 = !{}
62!3 = !{i32 2, !"Dwarf Version", i32 2}
63!4 = !{i32 2, !"Debug Info Version", i32 3}
64!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)
65!8 = !DISubroutineType(types: !2)
66!9 = !DILocation(line: 3, column: 20, scope: !7)
67!10 = !DILocation(line: 3, column: 3, scope: !7)
68!11 = !DILocation(line: 6, column: 1, scope: !7)
69!12 = !DILocation(line: 4, column: 12, scope: !7)
70!13 = !{!14, !14, i64 0}
71!14 = !{!"omnipotent char", !15, i64 0}
72!15 = !{!"Simple C/C++ TBAA"}
73!16 = !DILocation(line: 4, column: 19, scope: !7)
74!17 = !DILocation(line: 4, column: 17, scope: !7)
75!18 = !DILocation(line: 4, column: 5, scope: !7)
76!19 = !DILocation(line: 4, column: 10, scope: !7)
77!20 = distinct !{!20, !21}
78!21 = !{!"llvm.loop.distribute.enable", i1 true}
79!22 = !{!"function_entry_count", i64 3}
80!23 = !{!"branch_weights", i32 99, i32 1}
81!24 = !{!"branch_weights", i32 1, i32 99}
82