Commit Graph

917 Commits

Author SHA1 Message Date
Peter Collingbourne
46e11c4c97 Implement categories for special case lists.
A special case list can now specify categories for specific globals,
which can be used to instruct an instrumentation pass to treat certain
functions or global variables in a specific way, such as by omitting
certain aspects of instrumentation while keeping others, or informing
the instrumentation pass that a specific uninstrumentable function
has certain semantics, thus allowing the pass to instrument callers
according to those semantics.

For example, AddressSanitizer now uses the "init" category instead of
global-init prefixes for globals whose initializers should not be
instrumented, but which in all other respects should be instrumented.

The motivating use case is DataFlowSanitizer, which will have a
number of different categories for uninstrumentable functions, such
as "functional" which specifies that a function has pure functional
semantics, or "discard" which indicates that a function's return
value should not be labelled.

Differential Revision: http://llvm-reviews.chandlerc.com/D1092

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185978 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-09 22:03:17 +00:00
Peter Collingbourne
c7087f8e42 Add some SpecialCaseList unit tests.
Differential Revision: http://llvm-reviews.chandlerc.com/D1091

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185977 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-09 22:03:12 +00:00
Sean Silva
845e196a52 Make BinaryRef output correctly in case of empty data.
Previously, it would simply output nothing, but it should output an
empty string `""`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185894 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-09 00:54:46 +00:00
Rafael Espindola
1cce797d32 We now always create files with the correct permissions. Simplify the interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185834 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08 16:42:01 +00:00
Rafael Espindola
2c87a1705e Fix windows build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185730 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-05 22:32:33 +00:00
Rafael Espindola
1276b39613 Use sys::fs::createTemporaryFile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185719 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-05 20:14:52 +00:00
Craig Topper
6227d5c690 Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185606 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-04 01:31:24 +00:00
David Blaikie
5186591cf5 Fix -Wsign-compare warning and remove windows-style line endings introduced by r185421
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185443 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-02 16:48:10 +00:00
Elena Demikhovsky
e5cb25f860 Fixed alignment of code sections in the JIT mode. Added a test to the JITMemoryManager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185421 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-02 12:24:22 +00:00
Michael Gottesman
b57770387a [APFloat] Ensure that we can properly parse strings that do not have null terminators.
rdar://14323230

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185397 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-01 23:54:08 +00:00
Matt Arsenault
76bf61fe07 Fix copypaste error in test.
Thename says it's an i32*, but it was actually creating another i8*

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185239 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 23:24:10 +00:00
Daniel Malea
8bb9ec15c8 Replace UNIXy path with os-independent one in DebugIR unit test
- should resolve windows buildbot failure



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185232 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 22:17:57 +00:00
Jakob Stoklund Olesen
5d3257e37c Fix a bad overflow check pointed out by Ben.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185226 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 21:51:18 +00:00
Daniel Malea
9e638df937 Fix Windows/Darwin build error in DebugIR unit tests
- mistakenly used get_current_dir() linux function
- replaced with getcwd/_getcwd as appropriate for current platform



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185225 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 21:49:53 +00:00
Andrew Kaylor
40d8171e3e Revising the MCJIT ObjectCache interface to allow subclasses to avoid retaining references to returned objects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185221 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 21:40:16 +00:00
Daniel Malea
5fa8186b8d Adding tests for DebugIR pass
- lit tests verify that each line of input LLVM IR gets a !dbg node and a
  corresponding entry of metadata that contains the line number 
- unit tests verify that DebugIR works as advertised in the interface
- refactored some useful IR generation functionality from the MCJIT unit tests
  so it can be reused



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185212 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 20:37:20 +00:00
Jakob Stoklund Olesen
d7648ff20f Add a division operator to BlockFrequency.
Allow a BlockFrequency to be divided by a non-zero BranchProbability
with saturating arithmetic. This will be used to compute the frequency
of a loop header given the probability of leaving the loop.

Our long division algorithm already saturates on overflow, so that was a
freebie.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185184 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 18:23:42 +00:00
Rafael Espindola
08ddd12e44 Add a convenience createUniqueDirectory function.
There are a few valid situation where we care about the structure inside a
directory, but not about the directory itself. A simple example is for unit
testing directory traversal.

PathV1 had a function like this, add one to V2 and port existing users of the
created temp file and delete it hack to using it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185059 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-27 03:45:31 +00:00
Michael Gottesman
fb76ffd10b [APFloat] Added unittest for APFloat.divide that checks special cases, result categories, and result statuses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185050 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-27 00:42:00 +00:00
Michael Gottesman
bb77593765 Removed two logging printf statements from the APFloat tests... = /.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185045 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-27 00:00:45 +00:00
Michael Gottesman
2eda897c3c [APFloat] Added unittest for APFloat.multiply that checks special cases, result categories, and result status.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185044 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 23:55:26 +00:00
Michael Gottesman
d7d88d969e [APFloat] Added unittest for APFloat.subtract that checks special cases, result categories, and result status.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185043 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 23:55:23 +00:00
Michael Gottesman
a8f9364461 [APFloat] Removed debugging cruft that snuck in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184974 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 17:59:36 +00:00
Rafael Espindola
df0f525cc4 Remove unused includes.
llvm itself is now PathV1 clean.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184947 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 13:54:34 +00:00
Rafael Espindola
50188c1f42 Port GetMainExecutable over to PathV2.
I will remove the V1 version as soon as I change clang in the next commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184914 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 05:01:35 +00:00
Michael Gottesman
567a1126fb [APFloat] Removed trailing whitespace from unittests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184715 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-24 09:58:09 +00:00
Michael Gottesman
683069ffba [APFloat] Added a large unittest for APFloat.add that checks that special values are computed correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184714 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-24 09:58:07 +00:00
Benjamin Kramer
b47aceaf06 Revert "BlockFrequency: Saturate at 1 instead of 0 when multiplying a frequency with a branch probability."
This reverts commit r184584. Breaks PPC selfhost.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184590 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-21 20:20:27 +00:00
Benjamin Kramer
93702a3b07 BlockFrequency: Saturate at 1 instead of 0 when multiplying a frequency with a branch probability.
Zero is used by BlockFrequencyInfo as a special "don't know" value. It also
causes a sink for frequencies as you can't ever get off a zero frequency with
more multiplies.

This recovers a 10% regression on MultiSource/Benchmarks/7zip. A zero frequency
was propagated into an inner loop causing excessive spilling.

PR16402.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184584 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-21 19:30:05 +00:00
Akira Hatanaka
deda39dbdf [mips] Remove Triple:mips from SupportedArchs in MCJIT unittests
MIPS does not handle multiple relocations correctly, so two tests from the
unittests are expected to fail. These are:
 - MCJITTest.return_global and
 - MCJITTest.multiple_functions.

Until the multiple relocations are fixed, XFAIL the MCJIT unittests for
MIPS. This issue is tracked as Bug 16250.

Patch by Petar Jovanovic.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184461 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 20:33:06 +00:00
Michael Gottesman
a1694e5784 [APFloat] Rename isIEEENormal => isNormal and remove old isNormal method.
The old isNormal is already functionally replaced by the method isFiniteNonZero
in r184350 and all references to said method were replaced in LLVM/clang in
r184356/134366.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184449 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 18:34:38 +00:00
Michael Gottesman
3781fbc29a [APFloat] Fix typo in test so we actually test if we handle denormals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184447 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 18:25:16 +00:00
Rafael Espindola
9aa3365426 Rename fs::GetUniqueID to fs::getUniqueID to match the style guide.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184431 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-20 15:06:35 +00:00
Michael Gottesman
4f71c1b2b9 [APFloat] Changed APFloat::isNormal => APFloat::isFiniteNonZero for all tests in unittests.
I forgot to to do this in r184356. The only references were in APFloatTest.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184366 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 21:53:45 +00:00
Aaron Ballman
4655485eb7 Modified the implementation of fs::GetUniqueID on Windows such that it actually finds a unique identifier for a file. Also adds unit tests for GetUniqueID.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184351 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 21:03:50 +00:00
Michael Gottesman
7032c883cd [APFloat] Added isFiniteNonZero predicate.
This is the first patch in a series of patches to rename isNormal =>
isFiniteNonZero and isIEEENormal => isNormal. In order to prevent careless
errors on my part the overall plan is:

1. Add the isFiniteNonZero predicate with tests. I can do this in a method
independent of isNormal. (This step is this patch).
2. Convert all references to isNormal with isFiniteNonZero. My plan is to
comment out isNormal locally and continually convert isNormal references =>
isFiniteNonZero until llvm/clang compiles.
3. Remove old isNormal and rename isIEEENormal to isNormal.
4. Look through all of said references from patch 2 and see if we can simplify
them by using the new isNormal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184350 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 21:00:17 +00:00
Bill Wendling
ae5758bac7 Add unit test to test a trivial verifier check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184338 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-19 19:26:44 +00:00
Rafael Espindola
675e0ac0bf Avoid using PathV1.h in Program.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183940 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-13 20:25:38 +00:00
Rafael Espindola
9f1d9fd196 Remove the program class.
It was only used to implement ExecuteAndWait and ExecuteNoWait. Expose just
those two functions and make Execute and Wait implementations details.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183864 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-12 20:58:35 +00:00
Rafael Espindola
a11c3e2501 Move PathV2.h to Path.h
Most clients have already been moved from Path V1 to V2. The ones using V1
now include PathV1.h explicitly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183801 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-11 22:21:28 +00:00
Aaron Ballman
0c79301807 sys::process::get_id() now returns the process ID instead of a process handle on Windows. Patch thanks to Kim Gräsman!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183621 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-08 20:29:03 +00:00
Benjamin Kramer
a77376dae1 BitVector: Do the right thing in all() when Size is a multiple of BITWORD_SIZE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183525 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 15:14:31 +00:00
Benjamin Kramer
597253da97 Optimize BitVector::all().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183521 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-07 14:14:38 +00:00
Michael Gottesman
b30718af1a IEEE-754R 5.7.2 General Operations is* operations (except for isCanonical).
Specifically the following work was done:

1. If the operation was not implemented, I implemented it.

2. If the operation was already implemented, I just moved its location
in the APFloat header into the IEEE-754R 5.7.2 section. If the name was
incorrect, I put in a comment giving the true IEEE-754R name.

Also unittests have been added for all of the functions which did not
already have a unittest.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183179 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-04 03:46:25 +00:00
Benjamin Kramer
44dbb749f0 Try to avoid "integer literal too big" warnings from older GCCs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183081 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-01 22:29:41 +00:00
Eric Christopher
769d24a60d Add support for adding the contents of a StringRef to the MD5 hash.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183054 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-31 22:34:56 +00:00
Eric Christopher
cbb45aa123 Convert more unsigned char -> uint8_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183053 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-31 22:34:52 +00:00
Michael Gottesman
504e2da08c [APFloat] Added a unittest for APFloat::getZero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183028 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-31 18:43:34 +00:00
Rafael Espindola
198f972077 Remove unused member.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182958 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 20:19:35 +00:00
Michael Gottesman
964722ca40 Implement IEEE-754R 2008 nextUp/nextDown functions in the guise of the function APFloat::next(bool nextDown).
rdar://13852078

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182945 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30 18:07:13 +00:00