From 8f0c63a6e776705f1df5127d90f164cfb232c694 Mon Sep 17 00:00:00 2001 From: Xinliang David Li Date: Mon, 1 Aug 2016 20:28:26 +0000 Subject: [Profile] Add new test case to cover comdat renaming Test checks that context specific profiles for comdat functions are not lost. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277381 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/profile/Inputs/comdat_rename.h | 13 +++++++++++++ test/profile/Inputs/comdat_rename_1.cc | 33 +++++++++++++++++++++++++++++++++ test/profile/Inputs/comdat_rename_2.cc | 18 ++++++++++++++++++ test/profile/Linux/comdat_rename.test | 6 ++++++ 4 files changed, 70 insertions(+) create mode 100644 test/profile/Inputs/comdat_rename.h create mode 100644 test/profile/Inputs/comdat_rename_1.cc create mode 100644 test/profile/Inputs/comdat_rename_2.cc create mode 100644 test/profile/Linux/comdat_rename.test (limited to 'test/profile') diff --git a/test/profile/Inputs/comdat_rename.h b/test/profile/Inputs/comdat_rename.h new file mode 100644 index 000000000..53e1007ac --- /dev/null +++ b/test/profile/Inputs/comdat_rename.h @@ -0,0 +1,13 @@ +struct FOO { + FOO() : a(0), b(0) {} + int callee(); + __attribute__((noinline)) void caller(int n) { + int r = callee(); + if (r == 0) { + a += n; + b += 1; + } + } + int a; + int b; +}; diff --git a/test/profile/Inputs/comdat_rename_1.cc b/test/profile/Inputs/comdat_rename_1.cc new file mode 100644 index 000000000..36f2a02fe --- /dev/null +++ b/test/profile/Inputs/comdat_rename_1.cc @@ -0,0 +1,33 @@ +#include "comdat_rename.h" +// callee's out-of-line instance profile data -- it comes +// from external calls to it from comdat_rename_2.cc. +// Its inline instance copy's profile data is different and +// is collected in 'caller''s context. +int FOO::callee() { + // CHECK-LABEL: define {{.*}}callee{{.*}} + // CHECK-NOT: br i1 {{.*}} + // CHECK: br {{.*}}label{{.*}}, label %[[BB1:[0-9]+]], !prof ![[PD1:[0-9]+]] + // CHECK: ;