[compiler-rt] r271528 - [profile] Add end-end test of vp for inline virtual functions
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 2 09:24:23 PDT 2016
Author: davidxl
Date: Thu Jun 2 11:24:21 2016
New Revision: 271528
URL: http://llvm.org/viewvc/llvm-project?rev=271528&view=rev
Log:
[profile] Add end-end test of vp for inline virtual functions
Make sure inline virtual function's address is properly recorded and
dumped in raw profile so that value profiling does not loss tracking.
(Second part of the test will be enabled after the lowering bug is fixed
in LLVM)
Added:
compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo.h
compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo_1.cc
compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo_2.cc
compiler-rt/trunk/test/profile/instrprof-icall-promo.test
Added: compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo.h?rev=271528&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo.h (added)
+++ compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo.h Thu Jun 2 11:24:21 2016
@@ -0,0 +1,4 @@
+struct A {
+ virtual int foo() { return 1; };
+ virtual int bar();
+};
Added: compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo_1.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo_1.cc?rev=271528&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo_1.cc (added)
+++ compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo_1.cc Thu Jun 2 11:24:21 2016
@@ -0,0 +1,7 @@
+#include "instrprof-icall-promo.h"
+
+A a;
+
+A* ap = &a;
+
+int ref(A* ap) { return ap->A::foo(); }
Added: compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo_2.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo_2.cc?rev=271528&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo_2.cc (added)
+++ compiler-rt/trunk/test/profile/Inputs/instrprof-icall-promo_2.cc Thu Jun 2 11:24:21 2016
@@ -0,0 +1,15 @@
+#include "instrprof-icall-promo.h"
+extern int ref(A *);
+
+int A::bar() { return 2; }
+
+extern A *ap;
+int test() {
+ for (int i = 0; i < 10000; i++) ap->foo();
+ return ref(ap);
+}
+
+int main() {
+ test();
+ return 0;
+}
Added: compiler-rt/trunk/test/profile/instrprof-icall-promo.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-icall-promo.test?rev=271528&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/instrprof-icall-promo.test (added)
+++ compiler-rt/trunk/test/profile/instrprof-icall-promo.test Thu Jun 2 11:24:21 2016
@@ -0,0 +1,17 @@
+RUN: %clangxx_profgen -O2 -Xclang -fprofile-instrument=llvm -c -o %t.1.o %S/Inputs/instrprof-icall-promo_1.cc
+RUN: %clangxx_profgen -O2 -Xclang -fprofile-instrument=llvm -c -o %t.2.o %S/Inputs/instrprof-icall-promo_2.cc
+
+RUN: %clangxx_profgen -O2 -Xclang -fprofile-instrument=llvm %t.2.o %t.1.o -o %t.gen.1
+RUN: LLVM_PROFILE_FILE=%t-icall.profraw %t.gen.1
+RUN: llvm-profdata merge -o %t-icall.profdata %t-icall.profraw
+RUN: %clangxx -O2 -Rpass=pgo-icall-prom -fprofile-instr-use=%t-icall.profdata -c -o %t.2.use.o %S/Inputs/instrprof-icall-promo_2.cc 2>&1 | FileCheck %s
+
+RUN: %clangxx_profgen -O2 -Xclang -fprofile-instrument=llvm %t.1.o %t.2.o -o %t.gen.2
+RUN: LLVM_PROFILE_FILE=%t-icall2.profraw %t.gen.2
+RUN: llvm-profdata merge -o %t-icall2.profdata %t-icall2.profraw
+# The following test will be re-enabled once a compiler bug is fixed.
+#: %clangxx -O2 -Rpass=pgo-icall-prom -fprofile-instr-use=%t-icall2.profdata -c -o %t.2.use.o %S/Inputs/instrprof-icall-promo_2.cc 2>&1 | FileCheck %s
+
+
+# CHECK: Promote indirect call to
+
More information about the llvm-commits
mailing list