[compiler-rt] r258437 - Resubmit test case with more restriction

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 21 13:59:19 PST 2016


Author: davidxl
Date: Thu Jan 21 15:59:19 2016
New Revision: 258437

URL: http://llvm.org/viewvc/llvm-project?rev=258437&view=rev
Log:
Resubmit test case with more restriction

The original submittion triggered a BFD linker bug (2.24) on Aarch64 only. Before
the build bot is upgraded to more recent linker, restrict the test to be 
executed only with gold linker.

Added:
    compiler-rt/trunk/test/profile/Inputs/instrprof-comdat-1.cpp
    compiler-rt/trunk/test/profile/Inputs/instrprof-comdat-2.cpp
    compiler-rt/trunk/test/profile/Inputs/instrprof-comdat.h
    compiler-rt/trunk/test/profile/Linux/instrprof-comdat.test

Added: compiler-rt/trunk/test/profile/Inputs/instrprof-comdat-1.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-comdat-1.cpp?rev=258437&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/Inputs/instrprof-comdat-1.cpp (added)
+++ compiler-rt/trunk/test/profile/Inputs/instrprof-comdat-1.cpp Thu Jan 21 15:59:19 2016
@@ -0,0 +1,17 @@
+#include "instrprof-comdat.h"
+int g;
+extern int bar(int);
+
+int main() {
+
+  FOO<int> Foo;
+
+  int Res = Foo.DoIt(10);
+
+  if (Res > 10)
+    g = bar(10);
+  else
+    g = bar(1) + bar(2);
+  return 0;
+}
+

Added: compiler-rt/trunk/test/profile/Inputs/instrprof-comdat-2.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-comdat-2.cpp?rev=258437&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/Inputs/instrprof-comdat-2.cpp (added)
+++ compiler-rt/trunk/test/profile/Inputs/instrprof-comdat-2.cpp Thu Jan 21 15:59:19 2016
@@ -0,0 +1,12 @@
+#include "instrprof-comdat.h"
+
+int bar(int I) {
+
+  FOO<long> Foo;
+  FOO<int> Foo2;
+
+  if (I > 5)
+    return (int)Foo.DoIt(10);
+  else
+    return (int)Foo2.DoIt(I);
+}

Added: compiler-rt/trunk/test/profile/Inputs/instrprof-comdat.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-comdat.h?rev=258437&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/Inputs/instrprof-comdat.h (added)
+++ compiler-rt/trunk/test/profile/Inputs/instrprof-comdat.h Thu Jan 21 15:59:19 2016
@@ -0,0 +1,23 @@
+// Template instantiations are placed into comdat sections. Check that
+// coverage data from different instantiations are mapped back to the correct
+// source regions.
+
+template <class T> class FOO {
+public:
+  FOO() : t(0) {}
+
+  T DoIt(T ti);
+
+private:
+  T t;
+};
+
+template <class T> T FOO<T>::DoIt(T ti) { // HEADER:  2| [[@LINE]]|template
+  for (T I = 0; I < ti; I++) {            // HEADER: 22| [[@LINE]]|  for (T
+    t += I;                               // HEADER: 20| [[@LINE]]|    t += I;
+    if (I > ti / 2)                       // HEADER: 20| [[@LINE]]|    if (I > ti 
+      t -= 1;                             // HEADER:  8| [[@LINE]]|      t -= 1;
+  }                                       // HEADER: 10| [[@LINE]]|  }
+                                          // HEADER:  1| [[@LINE]]|
+  return t;                               // HEADER:  1| [[@LINE]]|  return t;
+}

Added: compiler-rt/trunk/test/profile/Linux/instrprof-comdat.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Linux/instrprof-comdat.test?rev=258437&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/Linux/instrprof-comdat.test (added)
+++ compiler-rt/trunk/test/profile/Linux/instrprof-comdat.test Thu Jan 21 15:59:19 2016
@@ -0,0 +1,6 @@
+RUN: mkdir -p %t.d
+RUN: %clang_profgen -xc++ -o %t.d/comdat -fcoverage-mapping -fuse-ld=gold %S/../Inputs/instrprof-comdat-1.cpp %S/../Inputs/instrprof-comdat-2.cpp
+RUN: LLVM_PROFILE_FILE=%t-comdat.profraw %t.d/comdat
+RUN: llvm-profdata merge -o %t.d/comdat.prof %t-comdat.profraw 
+RUN: llvm-cov show --filename-equivalence --instr-profile=%t.d/comdat.prof %t.d/comdat | FileCheck --check-prefix=HEADER %S/../Inputs/instrprof-comdat.h
+




More information about the llvm-commits mailing list