Clang Project

clang_source_code/test/CodeGen/opt-record.c
1// RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o %t -dwarf-column-info -opt-record-file %t.yaml -emit-obj
2// RUN: cat %t.yaml | FileCheck %s
3// RUN: llvm-profdata merge %S/Inputs/opt-record.proftext -o %t.profdata
4// RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 -fprofile-instrument-use-path=%t.profdata %s -o %t -dwarf-column-info -opt-record-file %t.yaml -emit-obj
5// RUN: cat %t.yaml | FileCheck -check-prefix=CHECK -check-prefix=CHECK-PGO %s
6// RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o %t -dwarf-column-info -opt-record-file %t.yaml -opt-record-passes inline -emit-obj
7// RUN: cat %t.yaml | FileCheck -check-prefix=CHECK-PASSES %s
8// REQUIRES: x86-registered-target
9
10void bar();
11void foo() { bar(); }
12
13void Test(int *res, int *c, int *d, int *p, int n) {
14  int i;
15
16#pragma clang loop vectorize(assume_safety)
17  for (i = 0; i < 1600; i++) {
18    res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
19  }
20}
21
22// CHECK: --- !Missed
23// CHECK: Pass:            inline
24// CHECK: Name:            NoDefinition
25// CHECK: DebugLoc:
26// CHECK: Function:        foo
27// CHECK-PGO: Hotness:
28// CHECK-PASSES: Pass: inline
29
30// CHECK: --- !Passed
31// CHECK: Pass:            loop-vectorize
32// CHECK: Name:            Vectorized
33// CHECK: DebugLoc:
34// CHECK: Function:        Test
35// CHECK-PGO: Hotness:
36// CHECK-PASSES-NOT: loop-vectorize
37