Commit Graph

280 Commits

Author SHA1 Message Date
Matt Morehouse 32c57553c3 [gcov] Disable instrprof-gcov-fork.test.
Test has been flaky for over a week and author hasn't fixed.

llvm-svn: 347779
2018-11-28 17:24:07 +00:00
Calixte Denizet 692b34790f [Profile] The test for gcov-fork seems to be ok on arm
Summary: Remove the XFAIL for arm since it seems to be ok

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: javed.absar, kristof.beyls, delcypher, chrib, llvm-commits, #sanitizers, sylvestre.ledru

Differential Revision: https://reviews.llvm.org/D54263

llvm-svn: 346409
2018-11-08 16:16:04 +00:00
Calixte Denizet db7f78a2cb [Profile] Mark gcov-fork test as failing for arm
Summary: instrprof-gcov-fork.test is failing with arm so mark it as XFAIL

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: javed.absar, kristof.beyls, delcypher, chrib, llvm-commits, sylvestre.ledru, #sanitizers

Differential Revision: https://reviews.llvm.org/D54209

llvm-svn: 346329
2018-11-07 15:58:18 +00:00
Calixte Denizet 5e09c49499 [Profile] Fix fork test and add tests for execlp and execvp after patch https://reviews.llvm.org/D53593
Summary: This is a follow-up of patch https://reviews.llvm.org/D53593

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: delcypher, llvm-commits, #sanitizers, sylvestre.ledru

Differential Revision: https://reviews.llvm.org/D54167

llvm-svn: 346314
2018-11-07 13:51:17 +00:00
Marco Castelluccio ed4bb266c8 [GCOV] Close file mapping handle on Windows, so flushed gcda files can be removed while the process is in execution
llvm-svn: 346300
2018-11-07 09:38:26 +00:00
Vedant Kumar 9e41b5eb6e [Darwin] Export new weak external symbols when compiling with coverage
Some weak external symbols were added to the profile runtime in D49953,
and on Darwin, these need to be exported for tapi verification purposes.

I've tightened the test so that future breakages can be caught earlier.

rdar://45831054

llvm-svn: 346276
2018-11-06 22:25:00 +00:00
Marco Castelluccio c8d94f3847 [GCOV] Make test path generic so it passes on all machines
llvm-svn: 345656
2018-10-30 21:43:47 +00:00
Calixte Denizet 4b0c66deb3 [GCOV] Add a test for function defined on one line (follow-up of https://reviews.llvm.org/D53600)
Summary: Add a test for coverage for function definition like void foo() { }.

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: delcypher, llvm-commits, #sanitizers, sylvestre.ledru

Differential Revision: https://reviews.llvm.org/D53601

llvm-svn: 345625
2018-10-30 18:41:41 +00:00
Calixte Denizet 589fff9c71 [profile] Fix the gcov tests after the patch in D49853 landed.
Summary:
The goal of the patch in D49853 is to display counter on the line of function definition.
So some tests need to be fixed.

Reviewers: marco-c, davidxl

Reviewed By: marco-c

Subscribers: sylvestre.ledru, delcypher, llvm-commits, #sanitizers

Differential Revision: https://reviews.llvm.org/D49854

llvm-svn: 344229
2018-10-11 08:53:55 +00:00
Calixte Denizet cb4cd5ccdc [Profile] Fix gcov tests
Summary: The gcda need to be delete before running the binary to avoid to have an increasing "# of Runs" when a test is failing

Reviewers: vitalybuka, eugenis, marco-c

Reviewed By: marco-c

Subscribers: delcypher, llvm-commits, #sanitizers, sylvestre.ledru, marco-c

Differential Revision: https://reviews.llvm.org/D52456

llvm-svn: 342963
2018-09-25 11:12:15 +00:00
Calixte Denizet d32508a932 [profile] Revert commit https://reviews.llvm.org/rL342718
llvm-svn: 342913
2018-09-24 18:24:29 +00:00
Calixte Denizet 8f7aab5c61 [profile] Fix the tests for patch in https://reviews.llvm.org/D49916.
Summary:
The goal of D49916 is to remove some hit counters from lines like '}'.
So as a consequence, the tests must be fixed.
FYI, after holidays, I'll add more tests.

Reviewers: marco-c, davidxl

Reviewed By: marco-c

Subscribers: delcypher, llvm-commits, #sanitizers, sylvestre.ledru

Differential Revision: https://reviews.llvm.org/D49917

llvm-svn: 342718
2018-09-21 09:17:14 +00:00
Calixte Denizet 6dde0d4283 [profile] Fix tests in compiler-rt for patch in gcov (https://reviews.llvm.org/D49659)
Summary: Some tests are broken if patch in D49659 is accepted so this patch fixes them.

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: dberris, delcypher, llvm-commits, #sanitizers

Differential Revision: https://reviews.llvm.org/D49721

llvm-svn: 342661
2018-09-20 16:21:09 +00:00
Vedant Kumar 727d89526e [gcov] Fix branch counters with switch statements (fix PR38821)
Right now, the counters are added in regards of the number of successors
for a given BasicBlock: it's good when we've only 1 or 2 successors (at
least with BranchInstr). But in the case of a switch statement, the
BasicBlock after switch has several predecessors and we need know from
which BB we're coming from.

So the idea is to revert what we're doing: add a PHINode in each block
which will select the counter according to the incoming BB.  They're
several pros for doing that:

- we fix the "switch" bug
- we remove the function call to "__llvm_gcov_indirect_counter_increment"
  and the lookup table stuff
- we replace by PHINodes, so the optimizer will probably makes a better
  job.

Patch by calixte!

Differential Revision: https://reviews.llvm.org/D51619

llvm-svn: 341977
2018-09-11 18:38:34 +00:00
Vedant Kumar 381e9d2386 [Coverage] Ignore 'unused' functions with non-zero execution counts
Frontends emit 'unused' coverage mapping records for functions which are
provably unused in a TU. These unused records contain a single counter
with CounterKind::Zero. However, a function may be unused in one TU and
used in another. When this happens, prefer the records with a full set
of counters instead of arbitrarily picking the first loaded record.

There is no impact on the single-TU case. In the multiple-TU case, this
resolves issues causing a function to appear unused when it's not.

Testing: check-{llvm,clang,compiler-rt}

rdar://42981322

llvm-svn: 339194
2018-08-07 22:25:36 +00:00
Marco Castelluccio 85ae51ed22 [gcov] Add test which uses fork
Test for https://bugs.llvm.org/show_bug.cgi?id=38180.

llvm-svn: 338500
2018-08-01 09:11:36 +00:00
Matt Davis 89e8af6d96 [compiler-rt] Add a routine to specify the mode used when creating profile dirs.
Summary:
This patch introduces `llvm_profile_set_dir_mode` and `llvm_profile_get_dir_mode` to
the compiler-rt profile API. 

Originally, profile data was placed into a directory that was created with a hard-coded
mode value of 0755 (for non-win32 builds).  In certain cases, it can be helpful to create
directories with a different mode other than 0755.  This patch introduces set/get
routines to allow users to specify a desired mode.  The default remains at 0755.

Reviewers: void, probinson

Reviewed By: probinson

Subscribers: probinson, dberris, cfe-commits

Differential Revision: https://reviews.llvm.org/D49953

llvm-svn: 338456
2018-07-31 23:37:24 +00:00
Marco Castelluccio ae43a27f9c [gcov] Add tests using switch, one with break clauses and one with fallthrough
llvm-svn: 338453
2018-07-31 23:26:50 +00:00
Teresa Johnson 408f50dbb4 [profile] Fix typo in test
Noticed that this was causing a compiler warning in the test.

llvm-svn: 337493
2018-07-19 20:18:37 +00:00
Teresa Johnson 73053b221f [profile] Add interface to get profile filename
Summary:
Add __llvm_profile_get_filename interface to get the profile filename,
which can be used for identifying which profile file belongs to an app
when multiple binaries are instrumented and dumping profiles into the
same directory. The filename includes the path.

Reviewers: davidxl

Subscribers: delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D49529

llvm-svn: 337482
2018-07-19 19:03:50 +00:00
Marco Castelluccio 1f0b194b4a [gcov] Add a test showing differences in line counts when building with or without exceptions enabled.
Test for https://bugs.llvm.org/show_bug.cgi?id=38066.

llvm-svn: 337174
2018-07-16 14:40:33 +00:00
Marco Castelluccio 0a75de4bfe Add a test with __gcov_flush called before terminating the program.
Test for https://bugs.llvm.org/show_bug.cgi?id=38067.

llvm-svn: 337150
2018-07-16 09:13:46 +00:00
Marco Castelluccio d47bde0d7a Add a test with multiple BBs on the same line
Test for https://bugs.llvm.org/show_bug.cgi?id=38065.

llvm-svn: 336996
2018-07-13 13:01:43 +00:00
Marco Castelluccio 2bb551c6bf Simplify instrprof-dlopen-dlclose-gcov.test to avoid failures on Aarch64.
The test for a function with an if block in a single line (https://bugs.llvm.org/show_bug.cgi?id=38065) will be moved to a separate test.

llvm-svn: 336942
2018-07-12 20:28:09 +00:00
Joel E. Denny da660d6a70 [FileCheck] Add -allow-deprecated-dag-overlap to failing compiler-rt tests
See https://reviews.llvm.org/D47106 for details.

Reviewed By: probinson

Differential Revision: https://reviews.llvm.org/D47326

llvm-svn: 336845
2018-07-11 20:26:44 +00:00
Zaara Syeda f3fd38effd Remove ppc64 BE XFAILs now that gcov profiling works, after starting a clean
build this time.

llvm-svn: 336839
2018-07-11 19:17:43 +00:00
Marco Castelluccio e125955890 Link to the correct bug number about the Mac failure for instrprof-shared-gcov-flush.test.
llvm-svn: 336820
2018-07-11 15:44:15 +00:00
Zaara Syeda 47c2ddf6b3 Revert 336811, there are still some problems with the tests.
llvm-svn: 336819
2018-07-11 15:37:19 +00:00
Zaara Syeda 495adf52db Remove ppc64 BE XFAILs now that gcov profiling works.
llvm-svn: 336811
2018-07-11 14:55:19 +00:00
Ulrich Weigand f0642bfe44 Remove s390x XFAILs now that gcov profiling works.
llvm-svn: 336695
2018-07-10 16:09:24 +00:00
Marco Castelluccio 2827420aab Reapply "Make __gcov_flush flush counters for all shared libraries"
This reapplies r336365, after marking tests as failing on various
configurations.

llvm-svn: 336678
2018-07-10 14:12:03 +00:00
Michael Zolotukhin 9664ca9dce Revert "Make __gcov_flush flush counters for all shared libraries"
This reverts r336365: the added tests are failing on various
configurations (e.g. on green-dragon).

llvm-svn: 336474
2018-07-07 00:07:00 +00:00
Marco Castelluccio 32d18beb8c Make __gcov_flush flush counters for all shared libraries
Summary:
This will make the behavior of __gcov_flush match the GCC behavior.

I would like to rename __gcov_flush to __llvm_gcov_flush (in case of programs linking to libraries built with different compilers), but I guess we can't for compatibility reasons.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: samsonov, vitalybuka, pcc, kcc, junbuml, glider, fhahn, eugenis, dvyukov, davidxl, srhines, chh, llvm-commits, #sanitizers

Differential Revision: https://reviews.llvm.org/D48538

llvm-svn: 336365
2018-07-05 15:52:59 +00:00
Chih-Hung Hsieh 7222e8e30b [profile] Add llvm_gcov_flush to be called outside a shared library
__gcov_flush is hidden.
For applications to dump profiling data of selected .so files,
they can use dlsym to find and call llvm_gcov_flush in each .so file.

Differential Revision: https://reviews.llvm.org/D45454

llvm-svn: 336019
2018-06-29 21:45:55 +00:00
Vedant Kumar c8735fbb4c [Darwin] Add an integration test for PGO + symbol exports
rdar://41470205

llvm-svn: 335891
2018-06-28 17:53:43 +00:00
Rong Xu 1a45e0cccc [profile] Move newly added test to the supported platform
Move test/profile/instrprof-value-merge.c from r328987 to Linux directory.

llvm-svn: 329016
2018-04-02 21:24:07 +00:00
Rong Xu 95ab7582f0 [profile] Fix value profile runtime merging issues
This patch fixes the following issues:
(1) The strong definition of the merge hook function was not working which
breaks the online value profile merging. This patch removes the weak
attribute of VPMergeHook and assigns the value dynamically.
(2) Truncate the proifle file so that we don't have garbage data at the end of
the file.
(3) Add new __llvm_profile_instrument_target_value() interface to do the value
profile update in batch. This is needed as the original incremental by 1
in __llvm_profile_instrument_target() is too slow for online merge.

Differential Revision: https://reviews.llvm.org/D44847

llvm-svn: 328987
2018-04-02 16:57:00 +00:00
Vedant Kumar a4c56923d2 [profile] Test the exported symbol set for empty programs
Programs without any code in them should export the exact same set of
symbols as programs with code, at least on Darwin. This is done to make
text-based API verification possible for certain Darwin frameworks.

llvm-svn: 326351
2018-02-28 19:00:16 +00:00
Serguei Katkov d535c4d9d2 Update test counter_promo_nest.c to meet llvm change
The test expects to see the pattern "load add store" twice
in a row.

However the test contains actually several instances of this pattern.
Currently the first pattern appears in the output twice.

But after LLVM change https://reviews.llvm.org/D42691 some addtional
modification is done and one of another pattern has been hoisted in
function entry block.

As a result we have another order of meeting this pattern.
The test is updated to meet this change.

llvm-svn: 324571
2018-02-08 07:15:49 +00:00
Rafael Espindola 23581e5ee4 Add space inside the regular expression.
This should now pass on both ppc and x86. Sorry about the noise.

llvm-svn: 324556
2018-02-08 02:29:56 +00:00
Rafael Espindola 8d1f53a78d Remove extra space.
Should fix the ppc bots.

llvm-svn: 324548
2018-02-08 00:39:19 +00:00
Rafael Espindola dee75682c8 Update for llvm change.
llvm-svn: 324541
2018-02-07 23:13:57 +00:00
Marco Castelluccio 8dfdfa65ed Hide some symbols to avoid a crash on shutdown when using code coverage
Summary:
gcov / gcda-based profiling crashes when shared libraries are unloaded

Patch by Benoit Belley and test by Marco Castelluccio for Firefox

See https://bugs.llvm.org/show_bug.cgi?id=27224 & https://bugzilla.mozilla.org/show_bug.cgi?id=1401230

Reviewers: davidxl, rnk, void

Subscribers: jessicah, marco-c, belleyb, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D38124

llvm-svn: 321703
2018-01-03 11:21:30 +00:00
Xinliang David Li 9d301b3750 [PGO] Test case changes for D41059
Differential Revision: http://reviews.llvm.org/D41059

llvm-svn: 320999
2017-12-18 17:56:42 +00:00
Vedant Kumar d7c9336a84 [profile] Port the runtime to Solaris (retry)
This includes a few nice bits of refactoring (e.g splitting out the
exclusive locking code into a common utility).

Hopefully the Windows support is fixed now.

Patch by Rainer Orth!

Differential Revision: https://reviews.llvm.org/D40944

llvm-svn: 320731
2017-12-14 19:01:04 +00:00
Vedant Kumar e8e8599ade Revert "(HEAD -> master, origin/master, origin/HEAD) [profile] Port the runtime to Solaris"
This reverts commit r320726. It looks like flock isn't available on
Windows:

http://lab.llvm.org:8011/builders/sanitizer-windows/builds/21317/steps/build%20compiler-rt/logs/stdio

llvm-svn: 320728
2017-12-14 18:50:13 +00:00
Vedant Kumar 5b0d5b45a2 [profile] Port the runtime to Solaris
This includes a few nice bits of refactoring (e.g splitting out the
exclusive locking code into a common utility).

Patch by Rainer Orth!

Differential Revision: https://reviews.llvm.org/D40944

llvm-svn: 320726
2017-12-14 18:43:14 +00:00
Xinliang David Li 3905953582 Update test case for r320180
llvm-svn: 320181
2017-12-08 19:38:42 +00:00
Xinliang David Li b0c97e566f Test case update for D40873
llvm-svn: 320105
2017-12-07 22:23:43 +00:00
Xinliang David Li 52967ea5b1 Revert test case change for r319794
llvm-svn: 319842
2017-12-05 21:54:20 +00:00
Xinliang David Li 06be6debbc [PGO] fix test case for D40702
Differential Revision: http://reviews.llvm.org/D40702

llvm-svn: 319795
2017-12-05 17:19:49 +00:00
Roman Lebedev d45054dbd2 [ubsan] Re-commit: lit changes for lld testing, future lto testing.
Summary:
As discussed in https://github.com/google/oss-fuzz/issues/933,
it would be really awesome to be able to use ThinLTO for fuzzing.
However, as @kcc has pointed out, it is currently undefined (untested)
whether the sanitizers actually function properly with LLD and/or LTO.

This patch is inspired by the cfi test, which already do test with LTO
(and/or LLD), since LTO is required for CFI to function.

I started with UBSan, because it's cmakelists / lit.* files appeared
to be the cleanest. This patch adds the infrastructure to easily add
LLD and/or LTO sub-variants of the existing lit test configurations.

Also, this patch adds the LLD flavor, that explicitly does use LLD to link.
The check-ubsan does pass on my machine. And to minimize the [initial]
potential buildbot breakage i have put some restrictions on this flavour.

Please review carefully, i have not worked with lit/sanitizer tests before.

The original attempt, r319525 was reverted in r319526 due
to the failures in compiler-rt standalone builds.

Reviewers: eugenis, vitalybuka

Reviewed By: eugenis

Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc

Differential Revision: https://reviews.llvm.org/D39508

llvm-svn: 319575
2017-12-01 19:36:29 +00:00
Xinliang David Li 8b97870c44 [PGO] Add a test case for infinite loops
Differential Revision: http://reviews.llvm.org/D40663

llvm-svn: 319463
2017-11-30 19:37:56 +00:00
Adam Nemet c1ffcec3ae Adjust test after r318159
llvm-svn: 318170
2017-11-14 19:00:08 +00:00
Evgeniy Stepanov 3747b826c4 Disable profile tests on Android.
They never actually worked, but this way they are not included in "check-all".

llvm-svn: 315511
2017-10-11 21:22:32 +00:00
Vedant Kumar 648752ab14 [profile] Update Linux-only tests after r313597
Addresses bot failure:
http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/9803

llvm-svn: 313602
2017-09-19 00:15:18 +00:00
Zachary Turner ce92db13ea Resubmit "[lit] Force site configs to run before source-tree configs"
This is a resubmission of r313270.  It broke standalone builds of
compiler-rt because we were not correctly generating the llvm-lit
script in the standalone build directory.

The fixes incorporated here attempt to find llvm/utils/llvm-lit
from the source tree returned by llvm-config.  If present, it
will generate llvm-lit into the output directory.  Regardless,
the user can specify -DLLVM_EXTERNAL_LIT to point to a specific
lit.py on their file system.  This supports the use case of
someone installing lit via a package manager.  If it cannot find
a source tree, and -DLLVM_EXTERNAL_LIT is either unspecified or
invalid, then we print a warning that tests will not be able
to run.

Differential Revision: https://reviews.llvm.org/D37756

llvm-svn: 313407
2017-09-15 22:10:46 +00:00
Zachary Turner 83dcb68468 Revert "[lit] Force site configs to run before source-tree configs"
This patch is still breaking several multi-stage compiler-rt bots.
I already know what the fix is, but I want to get the bots green
for now and then try re-applying in the morning.

llvm-svn: 313335
2017-09-15 02:56:40 +00:00
Zachary Turner a0e55b6403 [lit] Force site configs to be run before source-tree configs
This patch simplifies LLVM's lit infrastructure by enforcing an ordering
that a site config is always run before a source-tree config.

A significant amount of the complexity from lit config files arises from
the fact that inside of a source-tree config file, we don't yet know if
the site config has been run.  However it is *always* required to run
a site config first, because it passes various variables down through
CMake that the main config depends on.  As a result, every config
file has to do a bunch of magic to try to reverse-engineer the location
of the site config file if they detect (heuristically) that the site
config file has not yet been run.

This patch solves the problem by emitting a mapping from source tree
config file to binary tree site config file in llvm-lit.py. Then, during
discovery when we find a config file, we check to see if we have a
target mapping for it, and if so we use that instead.

This mechanism is generic enough that it does not affect external users
of lit. They will just not have a config mapping defined, and everything
will work as normal.

On the other hand, for us it allows us to make many simplifications:

* We are guaranteed that a site config will be executed first
* Inside of a main config, we no longer have to assume that attributes
  might not be present and use getattr everywhere.
* We no longer have to pass parameters such as --param llvm_site_config=<path>
  on the command line.
* It is future-proof, meaning you don't have to edit llvm-lit.in to add
  support for new projects.
* All of the duplicated logic of trying various fallback mechanisms of
  finding a site config from the main config are now gone.

One potentially noteworthy thing that was required to implement this
change is that whereas the ninja check targets previously used the first
method to spawn lit, they now use the second. In particular, you can no
longer run lit.py against the source tree while specifying the various
`foo_site_config=<path>` parameters.  Instead, you need to run
llvm-lit.py.

Differential Revision: https://reviews.llvm.org/D37756

llvm-svn: 313270
2017-09-14 16:47:58 +00:00
Kamil Rytarowski d341194d68 Revert: Enable profile on NetBSD
Requested by V.Kumar.

Not all tests pass.

llvm-svn: 310912
2017-08-15 09:56:47 +00:00
Xinliang David Li 1c9320cd4d Revert r310857 due to internal test failure
llvm-svn: 310907
2017-08-15 03:13:01 +00:00
Xinliang David Li 533d4c90bd [PGO] Add support for relocate profile dumping directory
Differential Revsion: http://reviews.llvm.org/D36648

llvm-svn: 310857
2017-08-14 16:51:05 +00:00
Sean Eveson cf9525eac2 [llvm-cov] Fix compiler-rt tests failing in build bots after rL310827.
The compiler-rt tests used llvm-cov with -filename-equivelence, which was
replaced with the new option -path-equivalence in rL310827.

llvm-svn: 310836
2017-08-14 12:43:05 +00:00
Kamil Rytarowski c4edc0705c Enable profile on NetBSD
Summary:
make check-profile:

Failing Tests (2):
    Profile-i386 :: instrprof-dlopen.test
    Profile-x86_64 :: instrprof-dlopen.test

  Expected Passes    : 64
  Unsupported Tests  : 42
  Unexpected Failures: 2

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, kcc, filcab, fjricci

Reviewed By: vitalybuka

Subscribers: vsk, llvm-commits, srhines, mgorny, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D36603

llvm-svn: 310800
2017-08-13 20:18:15 +00:00
Vedant Kumar 696e3847dd coverage: Update tests to reflect changes from r310012
llvm-svn: 310015
2017-08-04 01:22:19 +00:00
Xinliang David Li 028c78b593 Fix broken test
llvm-svn: 307869
2017-07-13 00:22:01 +00:00
Xinliang David Li 07df59b7b6 [PGO] Add a test for 2-deep loop nest
llvm-svn: 307864
2017-07-12 23:28:45 +00:00
Vedant Kumar ff3227e77d [profile] Move __llvm_profile_filename into a separate object
Users can specify the path a raw profile is written to by passing
-fprofile-instr-generate=<path>, but this functionality broke on Darwin
after __llvm_profile_filename was made weak [1], resulting in profiles
being written to "default.profraw" even when <path> is specified.

The situation is that instrumented programs provide a weak definition of
__llvm_profile_filename, which conflicts with a weak redefinition
provided by the profiling runtime.

The linker appears to pick the 'winning' definition arbitrarily: on
Darwin, it usually prefers the larger definition, which is probably why
the instrprof-override-filename.c test has been passing.

The fix is to move the runtime's definition into a separate object file
within the archive. This means that the linker won't "see" the runtime's
definition unless the user program has not provided one. I couldn't
think of a great way to test this other than to mimic the Darwin
failure: use -fprofile-instr-generate=<some-small-path>.

Testing: check-{clang,profile}, modified instrprof-override-filename.c.

[1] [Profile] deprecate __llvm_profile_override_default_filename
https://reviews.llvm.org/D22613
https://reviews.llvm.org/D22614

Differential Revision: https://reviews.llvm.org/D34797

llvm-svn: 306710
2017-06-29 17:42:24 +00:00
Xinliang David Li 95ce779185 [PGO] Implementate profile counter regiser promotion (test case)
Differential Revision: http://reviews.llvm.org/D34085

llvm-svn: 306232
2017-06-25 00:27:09 +00:00
Xinliang David Li 384f704834 Minor clean up of profile rt tests
llvm-svn: 305113
2017-06-09 21:14:19 +00:00
Renato Golin 18342e39e6 Revert "[PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write"
Revert "[PGO] remove unintended debug trace. NFC"

This reverts commit r295469, r295364, as they are unstable on ARM/AArch64.

llvm-svn: 295664
2017-02-20 15:03:12 +00:00
Rong Xu 72f1e5440e [PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write
Summary:
We found a nondeterministic behavior when doing online profile merging
for multi-process applications. The application forks a sub-process and
sub-process sets to get SIGKILL when the parent process exits,

The first process gets the lock, and dumps the profile. The second one
will mmap the file, do the merge and write out the file. Note that before
the merged write, we truncate the profile.

Depending on the timing, the child process might be terminated
abnormally when the parent exits first. If this happens:
(1) before the truncation, we will get the profile for the main process
(2) after the truncation, and before write-out the profile,  we will get
0 size profile.
(3) after the merged write, we get merged profile.

This patch temporarily suspend the SIGKILL for PR_SET_PDEATHSIG
before profile-write and restore it after the write.

This patch only applies to Linux system.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: xur, llvm-commits

Differential Revision: https://reviews.llvm.org/D29954

llvm-svn: 295364
2017-02-16 19:21:31 +00:00
Xinliang David Li f2d9481028 [PGO] Delay profile dir creation until write
Differential Revision: http://reviews.llvm.org/D29960

llvm-svn: 295108
2017-02-14 21:39:55 +00:00
Rong Xu af2f1dbde8 [PGO] Update the test cases after r291588.
llvm-svn: 291594
2017-01-10 20:07:01 +00:00
Francis Ricci 17781c71b0 Make cmake link flag naming consistent
Summary:
The build system was inconsistent in its naming conventions for
link flags. This patch changes all uses of LINKFLAGS to LINK_FLAGS,
for consistency with cmake's LINK_FLAGS property.

This patch should make it easier to search the source code for
uses of link flags, as well as providing the benefit of improved
style and consistency.

Reviewers: compnerd, beanz

Subscribers: kubabrecka, llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D28506

llvm-svn: 291539
2017-01-10 04:33:04 +00:00
NAKAMURA Takumi 5ce101a848 compiler-rt/test/profile/Linux/lit.local.cfg: [Py3] Use text mode (universal_newlines=True).
llvm-svn: 288490
2016-12-02 08:17:17 +00:00
Xinliang David Li 8b19a0a100 [Profile] Fix value profiler eviction bug
Differential Revision: https://reviews.llvm.org/D27224

llvm-svn: 288204
2016-11-29 22:00:54 +00:00
Kuba Mracek ff1bd20ded [sanitizer] Add macOS minimum deployment target to all compiler invocations in lit tests
The Clang driver on macOS decides the deployment target based on various things, like your host OS version, the SDK version and some environment variables, which makes lit tests pass or fail based on your environment. Let's make sure we run all lit tests with `-mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}` (10.9 unless overriden).

Differential Revision: https://reviews.llvm.org/D26929

llvm-svn: 288186
2016-11-29 19:25:53 +00:00
Vedant Kumar 6ff82bd0ec [profile] Mark lprofCurFilename as COMPILER_RT_WEAK
This makes __llvm_profile_set_filename() work across dylib boundaries on
Darwin.

This functionality was originally meant to work on all platforms, but
was moved to a Linux-only directory with r272404. The root cause of the
test failure on Darwin was that lprofCurFilename was not marked weak.
Each dylib maintained its own copy of the variable due to the two-level
namespace.

Tested with check-profile (on Darwin). I don't expect this to regress
other platforms.

Differential Revision: https://reviews.llvm.org/D25707

llvm-svn: 284440
2016-10-18 00:02:28 +00:00
Vedant Kumar d5454ce10e [profile] Add test for dead_strip+live_support functionality
Differential Revision: https://reviews.llvm.org/D25457

llvm-svn: 283948
2016-10-11 21:48:48 +00:00
Chad Rosier 6c46efba78 Fix the following tests when running under cross-compilation:
Profile-aarch64 :: Linux/comdat_rename.test
 Profile-aarch64 :: Linux/extern_template.test
 Profile-aarch64 :: Linux/instrprof-comdat.test
 Profile-aarch64 :: Linux/instrprof-cs.c

The issue is that the created (aarch64) binaries were attempting to run natively
instead of running through %run, which guarantees running in the proper
environment if the compilation was configured correctly.

llvm-svn: 282264
2016-09-23 17:40:40 +00:00
Renato Golin fbd3de7851 Try to fix another profile test
Another CFG optimisation patch (280364) has broken bad profile tests, and this
is a similar attempt to fix the test without changing the semantics.

llvm-svn: 280373
2016-09-01 14:44:02 +00:00
Renato Golin 0f298a2655 Fix profile test assuming dumb compiler
Commit r280364 has introduced some call-graph optmisations making a profiler
test "fail" due to not expecting the compiler to be "smart", and fold constants
across functions. This commit works around the issue, leaving the origial
semantics intact.

llvm-svn: 280365
2016-09-01 13:45:47 +00:00
Vedant Kumar 5e3c5e8065 [test] Update coverage tests to sync up with r278152
This should fix the following bot failure:

  http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/6522

Patch by Ying Yi!

llvm-svn: 278164
2016-08-09 21:04:22 +00:00
Xinliang David Li 3b2c002c6d [Profile] Implement new API __llvm_profile_dump
The API is intended to be used by user to do fine
grained (per-region) control of profile dumping.

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

llvm-svn: 278092
2016-08-09 04:21:14 +00:00
Xinliang David Li 24a927b3c2 improve test cases to fix bot failure
llvm-svn: 277403
2016-08-01 23:20:30 +00:00
Xinliang David Li e594277683 Make test more robust with better matching
llvm-svn: 277387
2016-08-01 21:06:54 +00:00
Xinliang David Li 7380a0d4a6 [Profile] Add new test case to cover comdat renaming
Test checks that context specific profiles for comdat functions
are not lost.

llvm-svn: 277381
2016-08-01 20:28:26 +00:00
Xinliang David Li 52626f132c Fix a bug in lit var def: remove extra space
llvm-svn: 277312
2016-08-01 01:54:40 +00:00
Xinliang David Li f418bb8023 [Profile] Add a new test case
The end-end test checks that cs-profile counter update
is obtained as expected.

llvm-svn: 277276
2016-07-30 20:12:00 +00:00
Xinliang David Li 6f6825fe13 Fix buildbot failure
llvm-svn: 276512
2016-07-23 03:34:30 +00:00
Xinliang David Li 54bb751a87 [Profile] Tighten test with expected profile count
llvm-svn: 276500
2016-07-22 23:53:00 +00:00
Xinliang David Li 544ae6c4f3 [Profile] Fix a fixme in the test
llvm-svn: 276494
2016-07-22 23:44:06 +00:00
Xinliang David Li 5a6dc4c9b8 [Profile] Add new test
To test that online merging is enabled by default.

llvm-svn: 276493
2016-07-22 23:38:58 +00:00
Xinliang David Li e953933a9f [Profile] deprecate __llvm_profile_override_default_filename (part2)
This eliminates unncessary calls and init functions.

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

llvm-svn: 276355
2016-07-21 23:19:18 +00:00
Xinliang David Li fa7c6f0d84 [Profile] Add new test to cover %m specifier with shared library (instrumented)
llvm-svn: 276229
2016-07-21 02:58:28 +00:00
Xinliang David Li ab8d32d53a [Profile] More test clean up to read profile from directory specified by -fprofile-generate=
llvm-svn: 276226
2016-07-21 02:14:55 +00:00
Xinliang David Li f6b2ba687b [Profile] Cleanup test to use new dir input feature
llvm-svn: 276225
2016-07-21 01:53:41 +00:00
Xinliang David Li eaf238d494 [Profile] implement interface to get profile path prefix
Differential Revision:  http://reviews.llvm.org/D22546

llvm-svn: 276083
2016-07-20 04:26:09 +00:00
Xinliang David Li 5d2ea9dcf8 [Profile] Test cleanup -- use new lit var for IR PGO tests /NFC
llvm-svn: 276036
2016-07-19 22:12:00 +00:00