1 // RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o %t -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 -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 -opt-record-file %t.yaml -opt-record-passes inline -emit-obj
7 // RUN: cat %t.yaml | FileCheck -check-prefix=CHECK-PASSES %s
8 // RUN: not %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o %t -opt-record-file %t.yaml -opt-record-passes "(foo" -emit-obj 2>&1 | FileCheck -check-prefix=CHECK-PATTERN-ERROR %s
9 // RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o %t -opt-record-file %t.yaml -opt-record-format yaml -emit-obj
10 // RUN: cat %t.yaml | FileCheck %s
11 // RUN: not %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o %t -opt-record-file %t.yaml -opt-record-format "unknown-format" -emit-obj 2>&1 | FileCheck -check-prefix=CHECK-FORMAT-ERROR %s
12 // REQUIRES: x86-registered-target
15 void foo(void) { bar(); }
17 void Test(int *res
, int *c
, int *d
, int *p
, int n
) {
20 #pragma clang loop vectorize(assume_safety)
21 for (i
= 0; i
< 1600; i
++) {
22 res
[i
] = (p
[i
] == 0) ? res
[i
] : res
[i
] + d
[i
];
27 // CHECK: Pass: inline
28 // CHECK: Name: NoDefinition
30 // CHECK: Function: foo
31 // CHECK-PGO: Hotness:
32 // CHECK-PASSES: Pass: inline
35 // CHECK: Pass: loop-vectorize
36 // CHECK: Name: Vectorized
38 // CHECK: Function: Test
39 // CHECK-PGO: Hotness:
40 // CHECK-PASSES-NOT: loop-vectorize
42 // CHECK-PATTERN-ERROR: error: in pattern '(foo': parentheses not balanced
44 // CHECK-FORMAT-ERROR: error: unknown remark serializer format: 'unknown-format'