1 // Test if CSPGO instrumentation and use pass are invoked.
3 // Ensure Pass PGOInstrumentationGenPass is invoked.
4 // RUN: %clang_cc1 -O2 -fprofile-instrument=csllvm -fprofile-instrument-path=default.profraw %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN
5 // CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN: Running pass: PGOInstrumentationGenCreateVar on
6 // CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN: Running pass: PGOInstrumentationGen on
8 // RUN: rm -rf %t && mkdir %t
9 // RUN: llvm-profdata merge -o %t/noncs.profdata %S/Inputs/pgotestir.proftext
11 // Ensure Pass PGOInstrumentationUsePass and PGOInstrumentationGenPass are invoked.
12 // RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t/noncs.profdata -fprofile-instrument=csllvm -fprofile-instrument-path=default.profraw %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN2
13 // CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN2: Running pass: PGOInstrumentationUse
14 // CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN2: Running pass: PGOInstrumentationGenCreateVar on
15 // CHECK-CSPGOGENPASS-INVOKED-INSTR-GEN2: Running pass: PGOInstrumentationGen on
17 // Ensure Pass PGOInstrumentationUsePass is invoked only once.
18 // RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t/noncs.profdata %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-USE
19 // CHECK-PGOUSEPASS-INVOKED-USE: Running pass: PGOInstrumentationUse
20 // CHECK-PGOUSEPASS-INVOKED-USE-NOT: Running pass: PGOInstrumentationGenCreateVar
21 // CHECK-PGOUSEPASS-INVOKED-USE-NOT: Running pass: PGOInstrumentationUse
23 // Ensure Pass PGOInstrumentationUsePass is invoked twice.
24 // RUN: llvm-profdata merge -o %t/cs.profdata %S/Inputs/pgotestir_cs.proftext
25 // RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t/cs.profdata %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-USE2
26 // CHECK-PGOUSEPASS-INVOKED-USE2: Running pass: PGOInstrumentationUse
27 // CHECK-PGOUSEPASS-INVOKED-USE2: Running pass: PGOInstrumentationUse