Commit Graph

160 Commits

Author SHA1 Message Date
Xinliang David Li c1cf60b339 Test update : tighten up checks
llvm-svn: 260050
2016-02-07 20:05:06 +00:00
Xinliang David Li abf6d973f4 Add coverage tests (defaulted constructors/destructor)
llvm-svn: 260041
2016-02-07 16:31:13 +00:00
Vedant Kumar a06e8ca6c5 [profile] Support hostname expansion in LLVM_PROFILE_FILE
This patch adds support for expanding "%h" out to the machine hostname
in the LLVM_PROFILE_FILE environment variable.

Patch by Daniel Waters!

Differential Revision: http://reviews.llvm.org/D16371

llvm-svn: 259272
2016-01-29 23:52:11 +00:00
Xinliang David Li 0747c5c808 Fix a bug in test case (both ir,fe instr were turned on
llvm-svn: 258913
2016-01-27 07:42:41 +00:00
Xinliang David Li 3aa113321b [PGO] Add a test case covering IR based VP instrumentation
llvm-svn: 258732
2016-01-25 22:33:29 +00:00
Xinliang David Li 19c45e2e12 [PGO] Add test case covering clang FE based VP instrumentation
llvm-svn: 258730
2016-01-25 22:09:30 +00:00
Xinliang David Li 8b1f80779b 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.

llvm-svn: 258437
2016-01-21 21:59:19 +00:00
Renato Golin 533c32bdda Revert "[coverage] Add a test case to cover coverage testing with comdat"
This reverts commit r258255 and r258274, as it was breaking the AArch64 bot.

llvm-svn: 258314
2016-01-20 14:27:50 +00:00
Vedant Kumar 0b9df44cf1 [test] Add a short explanation to instrprof-comdat.h
llvm-svn: 258274
2016-01-20 02:31:25 +00:00
Xinliang David Li 6900596040 [coverage] Add a test case to cover coverage testing with comdat
llvm-svn: 258255
2016-01-20 00:11:36 +00:00
Xinliang David Li 944cd4d318 [Coverage] add test cases for coverage testing
1. One test covering coverage-mapping interfaction with linker GC
2. one test covering coverage-mapping with shared libaries

llvm-svn: 257782
2016-01-14 18:15:54 +00:00
Xinliang David Li 31ad54298e [PGO] Add Linux specific test cases for profile runtime
(second try with more strict config check)
Currently, only gc-sections related tests are added. Gold
linker currently is required due to PR19161 of bfd linker.

llvm-svn: 257456
2016-01-12 07:18:53 +00:00
Xinliang David Li 452f1a5576 Revert r257444 : arm build bots failure
llvm-svn: 257446
2016-01-12 05:39:26 +00:00
Xinliang David Li cfefae8a14 [PGO] Add Linux specific test cases for profile runtime
Currently, only gc-sections related tests are added. Gold
linker currently is required due to PR19161 of bfd linker.

llvm-svn: 257444
2016-01-12 04:54:24 +00:00
Xinliang David Li 385612c5b4 Fix comment of test
llvm-svn: 257443
2016-01-12 03:57:14 +00:00
Xinliang David Li a692421adb [PGO] Add runtime hook so that IR instrumentation can override version
IR level instrumentation needs to override version with variant bits.
No change for FE instrumentation is needed. Test case is added to
detect version mismatch.

llvm-svn: 257230
2016-01-08 23:31:57 +00:00
Xinliang David Li ec58c819fa Use more strict checks for merge Profile results
llvm-svn: 257151
2016-01-08 06:18:18 +00:00
Xinliang David Li 6d464151a6 [PGO] Update test to match sorted output
llvm-svn: 257146
2016-01-08 05:45:54 +00:00
Xinliang David Li cda3bc2062 [PGO]: Refactor VP data writer
Extract the buffered filer writer code used by value profile 
writer and turn it into common/sharable buffered fileIO 
interfaces. Added a test case for the buffered file writer and
rewrite the VP dumping using the new APIs.

llvm-svn: 256604
2015-12-29 23:54:41 +00:00
Xinliang David Li 54dd683726 [PGO]: Do not update Data->Value field during profile write.
The profile reader no longer depends on this field to be updated and point
to owning func's vp data. The VP data also no longer needs to be allocated
in a contiguous memory space.

Differential Revision:  http://reviews.llvm.org/D15258

llvm-svn: 256543
2015-12-29 07:13:59 +00:00
Xinliang David Li 69773fb0d2 Add more testing checks
llvm-svn: 256538
2015-12-29 06:42:12 +00:00
Xinliang David Li ebc4c25a50 [PGO] Make the test case more robust
Make the testing results not depending on function 
output order. This allows more strict result check.

llvm-svn: 256537
2015-12-29 06:28:44 +00:00
Xinliang David Li c30c88a240 Check test results more strictly (NFC)
llvm-svn: 256536
2015-12-29 06:26:43 +00:00
Xinliang David Li dad2b8f79a [PGO] add a test case in profiler runtime
Add a test case to cover profile dumping of functions with no
value sites, functions with value sites but no dynamic VP data, 
and functions with runtime VP data.

llvm-svn: 255327
2015-12-11 05:43:55 +00:00
Xinliang David Li 449133d8b4 [PGO] Split value profiling runtime into its own file
Value profile runtime depends on libc which breaks
buffer API implemenation with current file organization.

Test case is also updated to check more symbols.

llvm-svn: 255294
2015-12-10 20:24:09 +00:00
Xinliang David Li 55d927a4fd [PGO] Stop leaking libc function to buffer API impl
llvm-svn: 254943
2015-12-07 21:18:16 +00:00
Xinliang David Li da29bc41a6 [PGO] Fix build failure with -fprofile-instr-generate
and -no-integrated-as for source with static function.

The compiler generates assembly names containing \" in the
.s dump causing gnu assembler to complain. That issue will be
investigated separately. 

llvm-svn: 254705
2015-12-04 06:06:07 +00:00
Xinliang David Li ffb827f2bc [PGO] Unify VP data format between raw and indexed profile (runtime)
With the latest refactoring and code sharing patches landed, 
it is possible to unify the value profile implementation between
raw and indexed profile. This is part  in prfofile runtime.

Differential Revision: http://reviews.llvm.org/D15057

llvm-svn: 254678
2015-12-04 01:02:24 +00:00
Xinliang David Li 9ea3064be5 [PGO] Introduce error report macro in profile-rt
Also added a test case for runtime error reporting.

llvm-svn: 254625
2015-12-03 18:31:59 +00:00
Xinliang David Li b6c81d2b92 [PGO] Ensure profile section symbols are created (linux)
- This is to handle a corner case where profile lib is linked
  in but non of the modules are instrumented (On linux, since
  we avoided the overhead to emit runtime hook use functions so
  this is the side effect of that size optimization).
- Added a profile runtime test case to cover all scenarios of
  shared library builds. 

Differential Revision: http://reviews.llvm.org/D14468

llvm-svn: 253098
2015-11-13 22:33:07 +00:00
Diego Novillo eae951415e Add support for generating profiles in a given directory.
When the file is initialized, this patch checks whether the path
specifies a directory. If so, it creates the directory tree before
truncating the file.

Use default.profdata instead of pgo-data for default indexed profile name.

llvm-svn: 241824
2015-07-09 17:21:52 +00:00
Justin Bogner ba6e2ae0c5 profile: Fix link errors in this test on darwin
llvm-svn: 238622
2015-05-29 22:41:25 +00:00
Diego Novillo c88d5b6acd Test case for PR 23499.
llvm-svn: 238338
2015-05-27 17:03:26 +00:00
Justin Bogner 2d2faae647 profile: Use unique directory for tests that write default profile file
Fix a couple of new tests that were reverted because they were causing
intermittent test failures since they were writing the same default
"default.profraw" file. Fixed by creating a unique directory and
running tests in that directory.

Patch by Teresa Johnson. Thanks!

llvm-svn: 236168
2015-04-29 21:56:35 +00:00
Renato Golin 0ac9031fa1 Revert 2 tests from "Tests for r236055."
This partially reverts commit r236056, as the two tests were using the same
names and, when executed in parallel, were having intermittent failures.

llvm-svn: 236101
2015-04-29 13:40:57 +00:00
Eric Christopher 4b3dd38ce0 Tests for r236055.
Patch by Teresa Johnson.

llvm-svn: 236056
2015-04-28 22:56:57 +00:00
Duncan P. N. Exon Smith 4a7fddca0d Update lib/profile tests for metadata assembly change
Running the upgrade script from PR21532.  Hopefully this will unstick
compiler-rt bots [1] after r224257.

[1]: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_check/181/

llvm-svn: 224276
2014-12-15 21:34:19 +00:00
Justin Bogner aa5bb91f5a profile: Robustify instrprof tests
Change these tests not to rely on the exact metadata numbers the
profile data gets.

llvm-svn: 222279
2014-11-18 23:03:14 +00:00
Jay Foad 8e586617c4 InstrProf: support PowerPC64
Summary:
I don't know anything about profiling but it seems to work out of the
box on PowerPC64. At least "make check-profile" works.

A few tests needed tweaking because PowerPC64 IR declares main with
"define signext i32 @main" instead of just "define i32 @main".

This also fixes the asan asan_and_llvm_coverage_test test, which
compiles with -coverage so requires that a profiling version of
libclang_rt has been built.

Reviewers: dexonsmith, kcc, samsonov

Reviewed By: samsonov

Subscribers: samsonov, llvm-commits

Differential Revision: http://reviews.llvm.org/D6233

llvm-svn: 221877
2014-11-13 09:24:32 +00:00
Renato Golin 1aaa4bcdd1 Mark sanitizer tests XFAIL on ARMv7
ASAN, UBSAN and profile tests that don't work with arm-linux-gnueabi and
android also don't work on armv7l-linux-gnueabihf. Some of the tests have
known causes, others not yet. In order to get a green bot, I'm disabling
those tests for now and will investigate when the priority rises.

llvm-svn: 219343
2014-10-08 21:13:23 +00:00
Ed Maste 1419e9adb5 Run profile tests on FreeBSD
FreeBSD does not have libdl, so set it via lit.cfg instead of the test
input, as with asan.  Also remove it from Darwin test runs - it's not
necessary, but harmless there.

Add FreeBSD to the list of hosts to test.

Differential Revision: http://reviews.llvm.org/D5650

llvm-svn: 219227
2014-10-07 19:24:24 +00:00
Justin Bogner cc0d7eeb6d profile: Avoid name collisions between instrumentation and runtime
The naming scheme we're using for counters in profile data shares a
prefix with some fixed names we use for the runtime, notably
__llvm_profile_data_begin and _end. Embarrassingly, this means a
function called begin() can't be instrumented.

This modifies the runtime names so as not to collide with the
instrumentation.

llvm-svn: 217166
2014-09-04 15:45:31 +00:00
Greg Fitzgerald 40a6401b1f Run common and profile tests in cross-compiled builds.
Route target_cflags to common and profile tests

llvm-svn: 209248
2014-05-20 22:04:27 +00:00
Saleem Abdulrasool 44a8c7233a profile: explicitly initialize file name in the test
The instrprofile-write-file-only test was failing on the builtbots.  The runtime
library initialization is explicitly being discarded to avoid the atexit hook.
However, this would also prevent the filename from being initialized.  Thus,
when the write file was invoked, the filename would not be setup, and the test
would fail as the profiling data would never be written out.  Explicitly
initialize the filename to ensure that the data is written out when requested.
This should hopefully finally get the build bots all green again.

llvm-svn: 209099
2014-05-18 20:05:35 +00:00
Saleem Abdulrasool b2aa4726d2 profile: adjust flags for libdl
dlopen expects that the flags contains RTLD_LAZY or RTLD_NOW.  RTLD_LAZY will
resolve the symbol on first use, and is generally preferred due to efficiency.
Add this to fix the test failure on the build bots.

llvm-svn: 209098
2014-05-18 19:33:39 +00:00
Saleem Abdulrasool 1d338a3406 profile: add logging on failure
Add logging to report any failures that may occur on calls to libdl.  Without
this, it is difficult to identify the actual problem if the test fails.

llvm-svn: 209097
2014-05-18 19:33:37 +00:00
Saleem Abdulrasool 864e0740c0 profile: explicitly link against libdl
Add an explicit link against libdl.  libdl may not be indirectly pulled on some
Linux hosts.  Explicitly link against it.  This should hopefully improve the
state of the build bots.

llvm-svn: 209096
2014-05-18 18:39:19 +00:00
Duncan P. N. Exon Smith 55e4d66f0c InstrProf: Support profiling dlopen'd shared libraries
Shared objects are hard.  After this commit, we do the right thing when
profiling two separate shared objects that have been dlopen'd with
`RTLD_LOCAL`, when the main executable is *not* being profiled.

This mainly simplifies the writer logic.

  - At initialization, determine the output filename and truncate the
    file.  Depending on whether shared objects can see each other, this
    may happen multiple times.

  - At exit, each executable writes its own profile in append mode.

<rdar://problem/16918688>

llvm-svn: 209053
2014-05-17 01:27:30 +00:00
Duncan P. N. Exon Smith 870b77cd4d InstrProf: Create a PIC version of the profile runtime
These tests were XPASS-ing on Linux bots creating Mach-O, which makes
sense, since the real difference is the object format.

I'm hoping a short-term fix to get these tests passing on ELF is to
create two copies of the runtime -- one built with -fPIC, and one
without.  A follow-up patch will change clang's driver to pick between
them depending on whether `-shared` is specified.

llvm-svn: 208947
2014-05-16 04:07:09 +00:00
Duncan P. N. Exon Smith f6366cbeff InstrProf: XFAIL tests from r208940 on Linux
According to the buildbots, the new features for shared objects don't
work on ELF since it requires an -fPIC when building the profile
library.  XFAIL these tests for now.

It's possible we'll have to build two versions of the profile library on
Linux (one with -fPIC and one without), but it's not clear to me exactly
how to resolve this.

llvm-svn: 208946
2014-05-16 02:53:19 +00:00
Duncan P. N. Exon Smith 084398857a InstrProf: Fix shared object profiling
Change the API of the instrumented profiling library to work with shared
objects.

  - Most things are now declared hidden, so that each executable gets
    its own copy.

  - Initialization hooks up a linked list of writers.

  - The raw format with shared objects that are profiled consists of a
    concatenated series of profiles.  llvm-profdata knows how to deal
    with that since r208938.

<rdar://problem/16918688>

llvm-svn: 208940
2014-05-16 01:30:24 +00:00
Alp Toker 1ee7fc7a1a Fix typos
llvm-svn: 208841
2014-05-15 02:22:34 +00:00
Duncan P. N. Exon Smith b6bd2f6cf7 InstrProf: Pacify buildbots after r208460
llvm-svn: 208462
2014-05-09 23:47:49 +00:00
Duncan P. N. Exon Smith 238137294f InstrProf: Test the functions in the runtime
Check that the profile runtime works as expected.  This tests the
functions that are meant to be available to advanced users.

In particular, check that the `atexit()` hook can be disabled by
defining a custom `__llvm_profile_runtime` variable, that the libc
dependencies are optional, and that the various functions for writing
out files work for basic cases.

llvm-svn: 208460
2014-05-09 23:14:58 +00:00
Greg Fitzgerald 6759fd9fdd Allow any test to be executed via a %run command.
Configure %run with COMPILER_RT_EMULATOR:

  $ cmake -DCOMPILER_RT_EMULATOR="qemu-arm -L $SYSROOT"

llvm-svn: 207707
2014-04-30 21:32:30 +00:00
Duncan P. N. Exon Smith dd690a2ca4 InstrProfile: Use SANITIZER_COMMON_LIT_TEST_DEPS
Take advantage of the SANITIZER_COMMON_LIT_TEST_DEPS variable.

<rdar://problem/16458307>

llvm-svn: 205321
2014-04-01 16:05:15 +00:00
Duncan P. N. Exon Smith 48e24c7355 InstrProf: Turn on test for Linux
Enabling test/profile on Linux to get feedback from the buildbots.  I'm
hoping this just works...

<rdar://problem/16458307>

llvm-svn: 205319
2014-04-01 15:56:05 +00:00
Duncan P. N. Exon Smith a5f806e599 InstrProf: Remove LTO dependency from test
The -flto flag relies on linker features that are not available on all
platforms.

<rdar://problem/16458307>

llvm-svn: 205318
2014-04-01 15:29:27 +00:00
Duncan P. N. Exon Smith da91cbdfa8 InstrProf: lit.cfg magic for running tests from source
Implement magic in compiler-rt to enable llvm-lit to be invoked on the
source tree in lib/profile.  This relies on a paired commit in the llvm
tree that exposes a new built-in parameter.

<rdar://problem/16458307>

llvm-svn: 205263
2014-03-31 23:14:28 +00:00
Duncan P. N. Exon Smith ae2f0bbcf1 InstrProf: Add simple compiler-rt test
Add the test infrastructure for testing lib/profile and a single test.
This initial commit only enables the tests on Darwin, but they'll be
enabled on Linux soon after.

<rdar://problem/16458307>

llvm-svn: 205256
2014-03-31 22:45:37 +00:00