Clang Project

clang_source_code/test/CodeGen/pgo-instrumentation.c
1// 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
10
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
21