summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/Inputs/opt-record.proftext26
-rw-r--r--clang/test/CodeGen/opt-record.c33
-rw-r--r--clang/test/Driver/opt-record.c18
3 files changed, 77 insertions, 0 deletions
diff --git a/clang/test/CodeGen/Inputs/opt-record.proftext b/clang/test/CodeGen/Inputs/opt-record.proftext
new file mode 100644
index 00000000000..cf2530c6be5
--- /dev/null
+++ b/clang/test/CodeGen/Inputs/opt-record.proftext
@@ -0,0 +1,26 @@
+foo
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+30
+
+bar
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+30
+
+Test
+# Func Hash:
+269
+# Num Counters:
+3
+# Counter Values:
+1
+30
+15
+
diff --git a/clang/test/CodeGen/opt-record.c b/clang/test/CodeGen/opt-record.c
new file mode 100644
index 00000000000..3bc3c41f784
--- /dev/null
+++ b/clang/test/CodeGen/opt-record.c
@@ -0,0 +1,33 @@
+// 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
+// RUN: cat %t.yaml | FileCheck %s
+// RUN: llvm-profdata merge %S/Inputs/opt-record.proftext -o %t.profdata
+// 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
+// RUN: cat %t.yaml | FileCheck -check-prefix=CHECK -check-prefix=CHECK-PGO %s
+// REQUIRES: x86-registered-target
+
+void bar();
+void foo() { bar(); }
+
+void Test(int *res, int *c, int *d, int *p, int n) {
+ int i;
+
+#pragma clang loop vectorize(assume_safety)
+ for (i = 0; i < 1600; i++) {
+ res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
+ }
+}
+
+// CHECK: --- !Missed
+// CHECK: Pass: inline
+// CHECK: Name: NoDefinition
+// CHECK: DebugLoc:
+// CHECK: Function: foo
+// CHECK-PGO: Hotness:
+
+// CHECK: --- !Passed
+// CHECK: Pass: loop-vectorize
+// CHECK: Name: Vectorized
+// CHECK: DebugLoc:
+// CHECK: Function: Test
+// CHECK-PGO: Hotness:
+
diff --git a/clang/test/Driver/opt-record.c b/clang/test/Driver/opt-record.c
new file mode 100644
index 00000000000..c7db6533c4e
--- /dev/null
+++ b/clang/test/Driver/opt-record.c
@@ -0,0 +1,18 @@
+// RUN: %clang -### -S -o FOO -fsave-optimization-record %s 2>&1 | FileCheck %s
+// RUN: %clang -### -c -o FOO -fsave-optimization-record %s 2>&1 | FileCheck %s
+// RUN: %clang -### -c -fsave-optimization-record %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O
+// RUN: %clang -### -fsave-optimization-record %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O
+// RUN: %clang -### -S -fsave-optimization-record -x cuda -nocudainc -nocudalib %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O -check-prefix=CHECK-CUDA-DEV
+// RUN: %clang -### -fsave-optimization-record -x cuda -nocudainc -nocudalib %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O -check-prefix=CHECK-CUDA-DEV
+// RUN: %clang -### -S -o FOO -fsave-optimization-record -foptimization-record-file=BAR.txt %s 2>&1 | FileCheck %s -check-prefix=CHECK-EQ
+
+// CHECK: "-cc1"
+// CHECK: "-opt-record-file" "FOO.opt.yaml"
+
+// CHECK-NO-O: "-cc1"
+// CHECK-NO-O-DAG: "-opt-record-file" "opt-record.opt.yaml"
+// CHECK-CUDA-DEV-DAG: "-opt-record-file" "opt-record-device-cuda-nvptx64-nvidia-cuda-sm_20.opt.yaml"
+
+// CHECK-EQ: "-cc1"
+// CHECK-EQ: "-opt-record-file" "BAR.txt"
+
OpenPOWER on IntegriCloud