blob: 1dac36fa589ec020ce69c7010cee96a81ac972fb [file] [log] [blame]
Rong Xu522b5cb2016-02-29 18:54:59 +00001// Test if PGO instrumentation and use pass are invoked.
2//
3// Ensure Pass PGOInstrumentationGenPass is invoked.
4// RUN: %clang_cc1 -O2 -fprofile-instrument=llvm %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOGENPASS-INVOKED-INSTR-GEN
5// CHECK-PGOGENPASS-INVOKED-INSTR-GEN: PGOInstrumentationGenPass
6//
7// Ensure Pass PGOInstrumentationGenPass is not invoked.
8// RUN: %clang_cc1 -O2 -fprofile-instrument=clang %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOGENPASS-INVOKED-INSTR-GEN-CLANG
9// CHECK-PGOGENPASS-INVOKED-INSTR-GEN-CLANG-NOT: PGOInstrumentationGenPass
Rong Xu9c6f1532016-03-02 20:59:36 +000010
11// Ensure Pass PGOInstrumentationUsePass is invoked.
12// RUN: llvm-profdata merge -o %t.profdata %S/Inputs/pgotestir.profraw
13// RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t.profdata %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-INSTR-USE
14// CHECK-PGOUSEPASS-INVOKED-INSTR-USE: PGOInstrumentationUsePass
15//
16// Ensure Pass PGOInstrumentationUsePass is not invoked.
17// RUN: llvm-profdata merge -o %t.profdata %S/Inputs/pgotestclang.profraw
18// RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t.profdata %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-USE-CLANG
19// CHECK-PGOUSEPASS-INVOKED-USE-CLANG-NOT: PGOInstrumentationUsePass
20