1 ; REQUIRES: x86_64-linux
2 ; RUN: opt < %s -passes='pseudo-probe,loop-unroll-full' -verify-pseudo-probe -S -o %t 2>&1 | FileCheck %s --check-prefix=VERIFY
3 ; RUN: FileCheck %s < %t
5 ; VERIFY: *** Pseudo Probe Verification After LoopFullUnrollPass ***
6 ; VERIFY: Function foo:
7 ; VERIFY-DAG: Probe 6 previous factor 1.00 current factor 5.00
8 ; VERIFY-DAG: Probe 4 previous factor 1.00 current factor 5.00
10 declare void @foo2() nounwind
12 define void @foo(i32 %x) {
14 ; CHECK: call void @llvm.pseudoprobe(i64 [[#GUID:]], i64 1, i32 0, i64 -1)
15 %tmp = alloca [5 x i32*], align 16
16 br label %bb7.preheader
19 %spec.select.lcssa = phi i32 [ %spec.select, %bb10 ]
20 %tmp5.not = icmp eq i32 %spec.select.lcssa, 0
21 br i1 %tmp5.not, label %bb24, label %bb7.preheader
24 ; CHECK: call void @llvm.pseudoprobe(i64 [[#GUID:]], i64 3, i32 0, i64 -1)
25 %tmp1.06 = phi i32 [ 5, %bb ], [ %spec.select.lcssa, %bb3.loopexit ]
29 ; CHECK: call void @llvm.pseudoprobe(i64 [[#GUID:]], i64 4, i32 0, i64 -1)
30 ; CHECK: call void @foo2(), !dbg ![[#PROBE6:]]
31 ; CHECK: call void @llvm.pseudoprobe(i64 [[#GUID:]], i64 4, i32 0, i64 -1)
32 ; CHECK: call void @foo2(), !dbg ![[#PROBE6:]]
33 ; CHECK: call void @llvm.pseudoprobe(i64 [[#GUID:]], i64 4, i32 0, i64 -1)
34 ; CHECK: call void @foo2(), !dbg ![[#PROBE6:]]
35 ; CHECK: call void @llvm.pseudoprobe(i64 [[#GUID:]], i64 4, i32 0, i64 -1)
36 ; CHECK: call void @foo2(), !dbg ![[#PROBE6:]]
37 ; CHECK: call void @llvm.pseudoprobe(i64 [[#GUID:]], i64 4, i32 0, i64 -1)
38 ; CHECK: call void @foo2(), !dbg ![[#PROBE6:]]
39 ; CHECK: call void @llvm.pseudoprobe(i64 [[#GUID:]], i64 2, i32 0, i64 -1)
40 %indvars.iv = phi i64 [ 0, %bb7.preheader ], [ %indvars.iv.next, %bb10 ]
41 %tmp1.14 = phi i32 [ %tmp1.06, %bb7.preheader ], [ %spec.select, %bb10 ]
42 %tmp13 = getelementptr inbounds [5 x i32*], [5 x i32*]* %tmp, i64 0, i64 %indvars.iv
43 %tmp14 = load i32*, i32** %tmp13, align 8
44 %tmp15.not = icmp ne i32* %tmp14, null
45 %tmp18 = sext i1 %tmp15.not to i32
46 %spec.select = add nsw i32 %tmp1.14, %tmp18
47 call void @foo2(), !dbg !12
48 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
49 %exitcond.not = icmp eq i64 %indvars.iv.next, 5
50 br i1 %exitcond.not, label %bb3.loopexit, label %bb10, !llvm.loop !13
53 ; CHECK: call void @llvm.pseudoprobe(i64 [[#GUID:]], i64 5, i32 0, i64 -1)
57 ;; A discriminator of 186646583 which is 0xb200037 in hexdecimal, stands for a direct call probe
58 ;; with an index of 6 and a scale of -1%.
59 ; CHECK: ![[#PROBE6]] = !DILocation(line: 2, column: 20, scope: ![[#SCOPE:]])
60 ; CHECK: ![[#SCOPE]] = !DILexicalBlockFile(scope: ![[#]], file: ![[#]], discriminator: 186646583)
63 !llvm.module.flags = !{!9, !10}
65 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2)
66 !1 = !DIFile(filename: "test.c", directory: "")
68 !4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, retainedNodes: !2)
69 !5 = !DISubroutineType(types: !6)
71 !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
72 !9 = !{i32 2, !"Dwarf Version", i32 4}
73 !10 = !{i32 2, !"Debug Info Version", i32 3}
74 !11 = !{!"clang version 3.9.0"}
75 !12 = !DILocation(line: 2, column: 20, scope: !4)
76 !13 = distinct !{!13, !14}
77 !14 = !{!"llvm.loop.unroll.full"}