1 ; The purpose of this test is to check that the remark emission analysis result
2 ; stays valid when it can and is invalidated otherwise. The code is just
3 ; a minimal amount of code to exercise the pass.
5 ; First make sure we emit remarks on this test case.
6 ; RUN: opt %s -disable-output -aa-pipeline=basic-aa 2>&1 \
7 ; RUN: -passes='require<opt-remark-emit>,loop-mssa(licm)' \
8 ; RUN: -pass-remarks=licm -pass-remarks-with-hotness \
11 ; Check that passes which preserve BFI don't invalidate the emitter.
12 ; RUN: opt %s -disable-output -aa-pipeline=basic-aa 2>&1 \
13 ; RUN: -passes='require<opt-remark-emit>,instcombine,require<opt-remark-emit>,loop-mssa(licm)' -debug-pass-manager \
14 ; RUN: -pass-remarks=licm -pass-remarks-with-hotness \
15 ; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-PM-PRESERVE
17 ; Check that invalidating BFI computes a fresh emitter.
18 ; RUN: opt %s -disable-output -aa-pipeline=basic-aa 2>&1 \
19 ; RUN: -passes='require<opt-remark-emit>,invalidate<block-freq>,require<opt-remark-emit>,loop-mssa(licm)' -debug-pass-manager \
20 ; RUN: -pass-remarks=licm -pass-remarks-with-hotness \
21 ; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-PM-INVALIDATE
23 ; Check that invalidating BFI desn't compute a fresh emitter when we don't
24 ; request hotness remarks.
25 ; RUN: opt %s -disable-output -aa-pipeline=basic-aa 2>&1 \
26 ; RUN: -passes='require<opt-remark-emit>,invalidate<block-freq>,require<opt-remark-emit>,loop-mssa(licm)' -debug-pass-manager \
27 ; RUN: -pass-remarks=licm \
28 ; RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-PM-NO-INVALIDATE
30 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
32 define void @hoist(i32* %array, i32* noalias %p) {
33 ; CHECK-PM-PRESERVE: Running analysis: OptimizationRemarkEmitterAnalysis
34 ; CHECK-PM-PRESERVE: Running pass: InstCombinePass
35 ; CHECK-PM-PRESERVE-NOT: Invalidating analysis: OptimizationRemarkEmitterAnalysis
36 ; CHECK-PM-PRESERVE-NOT: Running analysis: OptimizationRemarkEmitterAnalysis
37 ; CHECK-PM-PRESERVE: Running pass: LICMPass
38 ; CHECK-PM-INVALIDATE: Running analysis: OptimizationRemarkEmitterAnalysis
39 ; CHECK-PM-INVALIDATE: Running pass: InvalidateAnalysisPass
40 ; CHECK-PM-INVALIDATE: Invalidating analysis: OptimizationRemarkEmitterAnalysis
41 ; CHECK-PM-INVALIDATE: Running analysis: OptimizationRemarkEmitterAnalysis
42 ; CHECK-PM-INVALIDATE: Running pass: LICMPass
43 ; CHECK-PM-NO-INVALIDATE: Running analysis: OptimizationRemarkEmitterAnalysis
44 ; CHECK-PM-NO-INVALIDATE: Running pass: InvalidateAnalysisPass
45 ; CHECK-PM-NO-INVALIDATE-NOT: Invalidating analysis: OptimizationRemarkEmitterAnalysis
46 ; CHECK-PM-NO-INVALIDATE-NOT: Running analysis: OptimizationRemarkEmitterAnalysis
47 ; CHECK-PM-NO-INVALIDATE: Running pass: LICMPass
53 %j = phi i32 [ 0, %Entry ], [ %Next, %Loop ]
54 %addr = getelementptr i32, i32* %array, i32 %j
55 %a = load i32, i32* %addr
56 ; CHECK: remark: /tmp/kk.c:2:20: hoisting load
57 %b = load i32, i32* %p, !dbg !8
59 store i32 %a2, i32* %addr
61 %cond = icmp eq i32 %Next, 0
62 br i1 %cond, label %Out, label %Loop
69 !llvm.module.flags = !{!3, !4}
72 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2)
73 !1 = !DIFile(filename: "/tmp/kk.c", directory: "/tmp")
75 !3 = !{i32 2, !"Debug Info Version", i32 3}
76 !4 = !{i32 1, !"PIC Level", i32 2}
77 !5 = !{!"clang version 3.9.0 "}
78 !6 = distinct !DISubprogram(name: "success", scope: !1, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)
79 !7 = !DISubroutineType(types: !2)
80 !8 = !DILocation(line: 2, column: 20, scope: !6)