Граф коммитов

58 Коммитов

Автор SHA1 Сообщение Дата
Betul Buyukkurt 667fbbb052 [PGO] Test update for revision 253484.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253485 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 18:15:55 +00:00
Xinliang David Li 82019f1fde Fix a soon to be invalid test
Remove a check that won't be valid when LLVM stops
emitting runtime hook user function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251611 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-29 04:04:07 +00:00
NAKAMURA Takumi 69270056dd Tweak a couple of -fprofile tests in clang/test to accept backslash in path.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241903 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-10 13:11:08 +00:00
Daniel Jasper 27b95a6f4a Remove test that tests referring to the current working directory. You
cannot assume that the current working directory is writable in all test
environments. I don't know a better way to write this test of hand, lets
discuss. Possibly, a better option would be to put these together with
other test testing the driver directly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241885 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-10 05:57:23 +00:00
Diego Novillo 9b5c02e4fa Add GCC-compatible flags -fprofile-generate and -fprofile-use.
This patch adds support for specifying where the profile is emitted in a
way similar to GCC. These flags are used to specify directories instead
of filenames. When -fprofile-generate=DIR is used, the compiler will
generate code to write to <DIR>/default.profraw.

The patch also adds a couple of extensions: LLVM_PROFILE_FILE can still be
used to override the directory and file name to use and -fprofile-use
accepts both directories and filenames.

To simplify the set of flags used in the backend, all the flags get
canonicalized to -fprofile-instr-{generate,use} when passed to the
backend. The decision to use a default name for the profile is done
in the driver.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241825 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-09 17:23:53 +00:00
NAKAMURA Takumi 7b739d9fee Fix a couple of tests in clang/test to match "x86_thiscallcc" introduced in r240971.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241047 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-30 08:02:26 +00:00
David Blaikie 51b2a6bc7d Account for calling convention specifiers in function definitions in IR test cases
Several tests wouldn't pass when executed on an armv7a_pc_linux triple
due to the non-default arm_aapcs calling convention produced on the
function definitions in the IR output. Account for this with the
application of a little regex.

Patch by Ying Yi.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240971 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-29 17:29:50 +00:00
Diego Novillo c52fbfeaa5 Display profile file name when emitting a file not found diagnostic.
When a profile file cannot be opened, we used to display just the error
message but not the name of the profile the compiler was trying to open.
This will become useful in the next set of patches that introduce
GCC-compatible flags to specify profiles.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240715 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-25 22:56:00 +00:00
Diego Novillo 3be568cfef Fix PPC failure. Adjust CHECK pattern.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238413 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 11:25:52 +00:00
Diego Novillo d19add9278 Set function entry counts with -fprofile-instr-use.
This generates function entry counts from instrumentation profiles.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238360 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 21:58:42 +00:00
Justin Bogner 9a7bb3c6db InstrProf: Change this triple back to %itanium_abi_triple
In my rush to fix the linux bots in r237805, I accidentally committed
a change to the triple. Revert that part.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237806 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 16:25:35 +00:00
Justin Bogner b1d2926301 InstrProf: Remove darwin-specific section names from this test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237805 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 16:21:26 +00:00
Justin Bogner f25f43b715 InstrProf: Increment the profile counter for all types of destructor
-fprofile-instr-generate does not emit counter increment intrinsics
for Dtor_Deleting and Dtor_Complete destructors with assigned
counters. This causes unnecessary [-Wprofile-instr-out-of-date]
warnings during profile-use runs even if the source has never been
modified since profile collection.

Patch by Betul Buyukkurt. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237804 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 16:16:23 +00:00
Justin Bogner 4610137c1c InstrProf: Update name of compiler-rt routine for setting filename
Patch by Teresa Johnson.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237187 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-12 21:23:16 +00:00
Sunil Srivastava 68c4808ed7 Changed renaming of local symbols by inserting a dot vefore the numeric suffix
details in http://reviews.llvm.org/D9483
goes with llvm checkin r237150


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237151 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-12 16:48:43 +00:00
Justin Bogner eed1e55e77 InstrProf: Add a couple of checks to this test
"Don't crash" tests are silly, we might as well check that the
counters are consistent here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236361 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-01 22:52:48 +00:00
Justin Bogner cc56792acc InstrProf: Support for setting profile output from command line
This change is the third of 3 patches to add support for specifying
the profile output from the command line via -fprofile-instr-generate=<path>,
where the specified output path/file will be overridden by the
LLVM_PROFILE_FILE environment variable.

This patch adds the necessary support to the clang frontend, and adds a
new test.

The compiler-rt and llvm parts are r236055 and r236288, respectively.

Patch by Teresa Johnson. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236289 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 23:49:42 +00:00
Justin Bogner 6691d93dd0 InstrProf: Fix handling of profile counters in the body of range based for
We were assigning the counter for the body of the loop to the loop
variable initialization for some reason here, but our tests completely
lacked coverage for range-for loops. This fixes that and makes the
logic generally more similar to the logic for a regular for.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236277 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 22:58:28 +00:00
Justin Bogner ab9df2111d InstrProf: Match a bit less strictly - some targets may add signext
Notably, this bot didn't like it:

  http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/5117

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235968 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-28 06:55:23 +00:00
Justin Bogner 7f4fa8c5a9 InstrProf: Mark code regions after throw expressions as unreachable
We weren't setting regions as being unreachable after C++ throw
expressions, leading to incorrect count propagations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235967 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-28 06:31:55 +00:00
David Blaikie 412865c8ea Fix this test so it doesn't try to open a file to write to the source tree
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234173 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-06 16:33:18 +00:00
NAKAMURA Takumi f44dfa9e90 clang/test/Profile/profile-does-not-exist.c: Avoid checking a message line in the message catalog.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234146 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-06 08:16:36 +00:00
Nico Weber 1259fb859d Don't crash when passing a non-existent file to -fprofile-instr-use=.
Fixes a regression from r229434.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234141 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-06 04:16:48 +00:00
Reid Kleckner bc350adc1e Re-land "MS ABI: lambda call operators are instance methods and should use thiscall"
Update the test cases to pass when lambda call operators use thiscall.

Update the lambda-to-block conversion operator to use the default free
function calling convention instead of the call operator's convention.

This reverts commit r233082 and re-instates r233023.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233835 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-01 20:22:13 +00:00
Justin Bogner c1dec21eaa InstrProf: Make profile variables private to reduce binary size overhead
When we instrument a program for profiling, we copy the linkage of an
instrumented function so that our datastructures merge in the same way
as the function. This avoids redundant copies for things like
linkonce, but ends up emitting names we never need to reference for
normal and internal symbols. Promoting internal and external linkage
to private for these variables reduces the size overhead of profiling
drastically.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232799 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-20 06:34:38 +00:00
David Blaikie a6eaa6b50b Test case updates for explicit type parameter to the gep operator
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232187 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-13 18:21:46 +00:00
Filipe Cabecinhas abe6486f97 Add -frtti/-fexceptions to some more tests that assume they're on
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230656 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-26 18:29:41 +00:00
Justin Bogner a2f3efa5cf InstrProf: Simplify a couple of tests after r230383
Most of the checks in these two tests were actually testing the
behaviour of the instrprof LLVM pass. Now that we're testing that
specifically in LLVM's test suite, it's better if we only test the
frontend's behaviour here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230387 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-24 21:49:28 +00:00
Justin Bogner 659e92bcfa InstrProf: Don't emit counter increments in dead code
We were previously emitting counter increments even if we didn't have
an insertion point, which would result in a CallInst with no
parent. This leads to a crash, as in pr22166, if we try to do
GlobalDCE.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225495 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 01:46:40 +00:00
Duncan P. N. Exon Smith d72d442691 IR: Make metadata typeless in assembly, clang side
Match LLVM changes from r224257.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224259 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 19:10:08 +00:00
Justin Bogner bb794d1419 InstrProf: Use LLVM's -instrprof pass for profiling
The logic for lowering profiling counters has been moved to an LLVM
pass. Emit the intrinsics rather than duplicating the whole pass in
clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223683 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-08 19:04:51 +00:00
Justin Bogner 9aadb4d6d8 InstrProf: Use the same names for variables as we use in the profile
There's no need to use different names for the local variables than we
use in the profile itself, and it's a bit simpler and easier to debug
if we're consistent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223173 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 23:15:30 +00:00
Justin Bogner b16d21adf2 InstrProf: Update for LLVM API change
We've added support for a multiple functions with the same name in
LLVM's profile data, so the lookup returning the function hash it
found doesn't make sense anymore. Update to pass in the hash we
expect.

This also adds a test that the version 1 format is still readable,
since the new API is expected to handle that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214586 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01 22:50:16 +00:00
Justin Bogner c912e4c787 CodeGen: Improve warnings about uninstrumented files when profiling
Improve the warning when building with -fprofile-instr-use and a file
appears not to have been profiled at all. This keys on whether a
function is defined in the main file or not to avoid false negatives
when one includes a header with functions that have been profiled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211760 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-26 01:45:07 +00:00
Duncan P. N. Exon Smith eaad5be644 InstrProf: Set profile data to visibility hidden
Shared objects are fairly broken for InstrProf right now -- a follow-up
commit in compiler-rt will fix the rest of this.

The main problem here is that at link time, profile data symbols in the
shared object might get used instead of symbols from the main
executable, creating invalid profile data sections.

<rdar://problem/16918688>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208939 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-16 01:24:00 +00:00
Justin Bogner 2196195a2a CodeGen: Avoid instrumenting implicit Decls more effectively
We don't assign counters for implicit Decls, but we were emitting code
to increment the (non-existent) counters and adding empty counter
lists in the output. This fixes the checks in assignRegionCounters and
emitInstrumentationData to do the right thing, and adds an assert for
the pathological case of emitting zero counters.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207203 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-25 07:20:05 +00:00
Justin Bogner dea85f9d24 test: Use llvm-profdata merge in Profile tests
In preparation for using a binary format for instrumentation based
profiling, explicitly treat the test inputs as text and transform them
before running. This will allow us to leave the checked in files in
human readable format once the instrumentation format is binary.

No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206509 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-17 22:49:06 +00:00
Keith Walker 8fa1f062bd Fix Profile:cxx-lambda.cpp test for targets that do not generate zeroext
Change an expected match to allow for the fact that some targets
may not generated the zeroext operation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206467 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-17 13:04:53 +00:00
Duncan P. N. Exon Smith 98461062a9 InstrProf: Calculate a better function hash
The function hash should change when control flow changes.  This patch
hashes the type of each AST node that affects counters, rather than just
counting how many there are.  These types are combined into a small
enumerator that currently has 16 values.

The new hash algorithm packs the enums for consecutively visited types
into a `uint64_t`.  In order to save space for new types, the types are
assumed to be 6-bit values (instead of 4-bit).  In order to minimize
overhead for functions with little control flow, the `uint64_t` is used
directly as a hash if it never fills up; if it does, it's passed through
an MD5 context.

<rdar://problem/16435801>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206397 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-16 16:03:27 +00:00
Justin Bogner 859d2b2489 CodeGen: Emit warnings for out of date profile data during PGO
This adds a warning that triggers when profile data doesn't match for
the source that's being compiled with -fprofile-instr-use=. This fires
only once per translation unit, as warning on every mismatched
function would be quite noisy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206322 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 21:22:35 +00:00
Justin Bogner c087dce522 CodeGen: Handle CapturedStmt in instrumentation based profiling
CapturedStmt was being ignored by instrumentation based profiling, and
its counters attributed to the containing function. Instead, we need
to treat this as a top level entity, like we do with blocks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206231 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15 00:50:54 +00:00
Justin Bogner 78c3eb55be CodeGen: Test instrumentation based profiling of templates
Make sure that templates are handled correctly by profile
instrumentation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206091 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-12 00:54:06 +00:00
Justin Bogner 85ac3c716b CodeGen: Fix handling of C++11 lambdas in profiling
Until now we were generating duplicate counters for lambdas: one set
in the function where the lambda was declared and another for the
lambda itself. Instead, we should skip over the bodies of lambdas in
their containing contexts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206081 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-11 23:06:35 +00:00
Justin Bogner 6699b197f6 CodeGen: Handle binary conditional operators in PGO instrumentation
This treats binary conditional operators in the same way as ternary
conditional operators for instrumentation based profiling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206021 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-11 06:10:10 +00:00
Justin Bogner 6acf9ee0e5 CodeGen: Don't create branch weight metadata from empty profiles
If all of our weights are zero when calculating branch weights, it
means we haven't profiled the code in question. Avoid creating a
metadata node that says all branches are equally likely in this case.

The test also checks constructs that hit the other createBranchWeights
overload. These were already working.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205606 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-04 02:48:51 +00:00
Duncan P. N. Exon Smith 97140c9270 InstrProf: Emit runtime hook directly in IRGen
-u behaviour is apparently not portable between linkers (see cfe-commits
discussions for r204379 and r205012).  I've moved the logic to IRGen,
where it should have been in the first place.

I don't have a Linux system to test this on, so it's possible this logic
*still* doesn't pull in the instrumented profiling runtime on Linux.

I'm in the process of getting tests going on the compiler-rt side
(llvm-commits "[PATCH] InstrProf: Add initial compiler-rt test").  Once
we have tests for the full flow there, the runtime logic should get a
whole lot less brittle.

<rdar://problem/16458307>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205023 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-28 17:53:22 +00:00
Bob Wilson 70f12c60af [PGO] Add simplified branch weights for Objective-C for-collection loops.
Conceptually one of these loops is just a while-loop, but the actual code-gen
is more complicated. We don't instrument all the different control flow edges
to get accurate counts for each conditional branch, nor do I think it makes
sense to do so. Instead, make the simplifying assumption that the loop behaves
like a while-loop. Use the same branch weights for the first check for an
empty collection as would be used for the back-edge of a while loop, and use
that same weighting for the innermost loop, ignoring the possibility that there
may be some extra code to go fetch more elements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204767 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 23:26:31 +00:00
Duncan P. N. Exon Smith 81e3346e95 PGO: Don't define instrumentation data available_externally
Variables with available_externally linkage can be dropped at will.
This causes link errors, since there are still references to the
instrumentation!  linkonce_odr is almost equivalent, so use that
instead.

As a drive-by fix (I don't have an Elf system, so I'm not sure how to
write a testcase), use linkonce linkage for the instrumentation of
extern_weak functions.

<rdar://problem/15943240>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204408 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20 22:50:08 +00:00
Duncan P. N. Exon Smith 7f817a7d8d PGO: Change runtime prefix from pgo to profile
These functions are in the profile runtime.  PGO comes later.

Unfortunately, there's only room for 16 characters in a Darwin section,
so use __llvm_prf_ instead of __llvm_profile_ for section names.

<rdar://problem/15943240>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204390 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20 20:00:41 +00:00
Justin Bogner 0ec537c758 CodeGen: Include a function hash in instrumentation based profiling
The hash itself is still the number of counters, which isn't all that
useful, but this separates the API changes from the actual
implementation of the hash and will make it easier to transition to
the ProfileData library once it's implemented.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204186 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-18 21:58:06 +00:00