1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00
Commit Graph

435 Commits

Author SHA1 Message Date
Kostya Serebryany
d9130c7b17 [asan] small code simplification
llvm-svn: 159522
2012-07-02 11:42:29 +00:00
Bill Wendling
53675fa303 Don't reinsert the 'atexit' function if it already exists.
llvm-svn: 159491
2012-06-30 20:21:19 +00:00
Chandler Carruth
4b51f99c87 Move llvm/Support/IRBuilder.h -> llvm/IRBuilder.h
This was always part of the VMCore library out of necessity -- it deals
entirely in the IR. The .cpp file in fact was already part of the VMCore
library. This is just a mechanical move.

I've tried to go through and re-apply the coding standard's preferred
header sort, but at 40-ish files, I may have gotten some wrong. Please
let me know if so.

I'll be committing the corresponding updates to Clang and Polly, and
Duncan has DragonEgg.

Thanks to Bill and Eric for giving the green light for this bit of cleanup.

llvm-svn: 159421
2012-06-29 12:38:19 +00:00
Kostya Serebryany
0075a4f152 [asan] set a hard limit on the number of instructions instrumented pear each BB. This is (hopefully temporary) workaround for PR13225
llvm-svn: 159344
2012-06-28 09:34:41 +00:00
Bill Wendling
e8949ecfa6 Move lib/Analysis/DebugInfo.cpp to lib/VMCore/DebugInfo.cpp and
include/llvm/Analysis/DebugInfo.h to include/llvm/DebugInfo.h.

The reasoning is because the DebugInfo module is simply an interface to the
debug info MDNodes and has nothing to do with analysis.

llvm-svn: 159312
2012-06-28 00:05:13 +00:00
NAKAMURA Takumi
4599dee67a llvm/lib: [CMake] Add explicit dependency to intrinsics_gen.
llvm-svn: 159112
2012-06-24 13:32:01 +00:00
Hans Wennborg
8c011bd43a Extend the IL for selecting TLS models (PR9788)
This allows the user/front-end to specify a model that is better
than what LLVM would choose by default. For example, a variable
might be declared as

  @x = thread_local(initialexec) global i32 42

if it will not be used in a shared library that is dlopen'ed.

If the specified model isn't supported by the target, or if LLVM can
make a better choice, a different model may be used.

llvm-svn: 159077
2012-06-23 11:37:03 +00:00
Bill Wendling
f0e0ba446d Register the gcov "writeout" at init time. Don't list this as a d'tor. Instead,
inject some code in that will run via the "__mod_init_func" method that
registers the gcov "writeout" function to execute at exit time.

The problem is that the "__mod_term_func" method of specifying d'tors is
deprecated on Darwin. And it can lead to some ambiguities when dealing with
multiple libraries.
<rdar://problem/11110106>

llvm-svn: 157852
2012-06-01 23:14:32 +00:00
Kostya Serebryany
9bdb57f07a [asan] instrument cmpxchg and atomicrmw
llvm-svn: 157683
2012-05-30 09:04:06 +00:00
Bill Wendling
9c2fb60e3d Implement the indirect counter increment code in a better way. Instead of
replicating the code for every place it's needed, we instead generate a function
that does that for us. This function is local to the executable, so there
shouldn't be any writing violations.

llvm-svn: 157564
2012-05-28 06:10:56 +00:00
Bill Wendling
c2a0abf91f The llvm_gcda_increment_indirect_counter function writes to the arguments that
are passed in. However, those arguments may be in a write-protected area, as far
as the runtime library is concerned. For instance, the data could be placed into
a 'linkedit' section, which isn't writable. Emit the code from
llvm_gcda_increment_indirect_counter directly into the function instead.

Note: The code for this is ugly, and can lead to bloat. We should look into
simplifying this code instead of having all of these branches.

<rdar://problem/11181370>

llvm-svn: 157505
2012-05-25 23:55:00 +00:00
Evgeniy Stepanov
3519d90668 Use zero-based shadow by default on Android.
llvm-svn: 157317
2012-05-23 11:52:12 +00:00
Kostya Serebryany
f224182c86 [tsan] typo and style (thanks to Nick Lewycky)
llvm-svn: 155986
2012-05-02 13:12:19 +00:00
Kostya Serebryany
c855c442c8 [asan] small optimization: do not emit "x+0" instructions
llvm-svn: 155701
2012-04-27 10:04:53 +00:00
Kostya Serebryany
0cd695bd39 [tsan] Atomic support for ThreadSanitizer, patch by Dmitry Vyukov
llvm-svn: 155698
2012-04-27 07:31:53 +00:00
Alexander Potapenko
1f7d60fd8a Fix issue 67 by checking that the interface functions weren't redefined in the compiled source file.
llvm-svn: 155346
2012-04-23 10:47:31 +00:00
Kostya Serebryany
67e32a152a [tsan] use llvm/ADT/Statistic.h for tsan stats
llvm-svn: 155341
2012-04-23 08:44:59 +00:00
Kostya Serebryany
3047a70ed9 [tsan] two more compile-time optimizations:
- don't isntrument reads from constant globals.
Saves ~1.5% of instrumented instructions on CPU2006
(counting static instructions, not their execution).
- don't insrument reads from vtable (which is a global constant too).
Saves ~5%.

I did not measure the run-time impact of this,
but it is certainly non-negative.

llvm-svn: 154444
2012-04-10 22:29:17 +00:00
Kostya Serebryany
01d463472d [tsan] compile-time instrumentation: do not instrument a read if
a write to the same temp follows in the same BB.
Also add stats printing.

On Spec CPU2006 this optimization saves roughly 4% of instrumented reads
(which is 3% of all instrumented accesses):
Writes            : 161216
Reads             : 446458
Reads-before-write: 18295

llvm-svn: 154418
2012-04-10 18:18:56 +00:00
Kostya Serebryany
605c594f4f [tsan] treat vtable pointer updates in a special way (requires tbaa); fix a bug (forgot to return true after instrumenting); make sure the tsan tests are run
llvm-svn: 153448
2012-03-26 17:35:03 +00:00
Kostya Serebryany
19681e071c [asan] fix one more bug related to long double
llvm-svn: 153189
2012-03-21 15:28:50 +00:00
Kostya Serebryany
f8cb0a65c1 [asan] don't emit __asan_mapping_offset/__asan_mapping_scale by default -- they are currently used only for experiments
llvm-svn: 153040
2012-03-19 16:40:35 +00:00
Kostya Serebryany
ee6f6a527d [tsan] use FunctionBlackList
llvm-svn: 152755
2012-03-14 23:33:24 +00:00
Kostya Serebryany
70c5b4a077 [asan] rename class BlackList to FunctionBlackList and move it into a separate file -- we will need the same functionality in ThreadSanitizer
llvm-svn: 152753
2012-03-14 23:22:10 +00:00
Evgeniy Stepanov
19a3f5fed4 ASan: use getTypeAllocSize instead of getTypeStoreSize.
This change replaces getTypeStoreSize with getTypeAllocSize in AddressSanitizer
instrumentation for stack allocations.

One case where old behaviour produced undesired results is an optimization in
InstCombine pass (PromoteCastOfAllocation), which can replace  alloca(T) with
alloca(S), where S has the same AllocSize, but a smaller StoreSize. Another
case is memcpy(long double => long double), where ASan will poison bytes 10-15
of a stack-allocated long double (StoreSize  10, AllocSize 16,
sizeof(long double) = 16).

See http://llvm.org/bugs/show_bug.cgi?id=12047 for more context.

llvm-svn: 151887
2012-03-02 10:41:08 +00:00
Kostya Serebryany
7b2649a9ca [tsan] fix compiler warnings
llvm-svn: 150449
2012-02-14 00:52:07 +00:00
Kostya Serebryany
5cd1e1380f ThreadSanitizer, a race detector. First LLVM commit.
Clang patch (flags) will follow shortly.
The run-time library will also follow, but not immediately.

llvm-svn: 150423
2012-02-13 22:50:51 +00:00
Kostya Serebryany
2de61e1628 [asan] unpoison the stack before every noreturn call. Fixes asan issue 37. llvm part
llvm-svn: 150102
2012-02-08 21:36:17 +00:00
Craig Topper
639b152ca5 Convert assert(0) to llvm_unreachable
llvm-svn: 149967
2012-02-07 05:05:23 +00:00
Chris Lattner
9782adedd7 reapply the patches reverted in r149470 that reenable ConstantDataArray,
but with a critical fix to the SelectionDAG code that optimizes copies
from strings into immediate stores: the previous code was stopping reading
string data at the first nul.  Address this by adding a new argument to
llvm::getConstantStringInfo, preserving the behavior before the patch.

llvm-svn: 149800
2012-02-05 02:29:43 +00:00
Argyrios Kyrtzidis
492f34016f Revert Chris' commits up to r149348 that started causing VMCoreTests unit test to fail.
These are:

r149348
r149351
r149352
r149354
r149356
r149357
r149361
r149362
r149364
r149365

llvm-svn: 149470
2012-02-01 04:51:17 +00:00
Chris Lattner
a9b3505e9a eliminate the "string" form of ConstantArray::get, using
ConstantDataArray::getString instead.

llvm-svn: 149365
2012-01-31 06:18:43 +00:00
Kostya Serebryany
e5567f0fe4 [asan] fix the ObjC support (asan Issue #33)
llvm-svn: 149300
2012-01-30 23:50:10 +00:00
Alexander Potapenko
bc80f88393 Fix compilation of ASan tests on OS X Lion (see http://code.google.com/p/address-sanitizer/issues/detail?id=32)
The redzones emitted by AddressSanitizer for CFString instances confuse the linker and are of little use, so we shouldn't add them. 

llvm-svn: 149243
2012-01-30 10:40:22 +00:00
Kostya Serebryany
0a789a0d8c [asan] correctly use ConstantExpr::getGetElementPtr. Catch by NAKAMURA Takumi
llvm-svn: 149172
2012-01-28 04:27:16 +00:00
Kostya Serebryany
ca8b911b2d [asan] enable asan only for the functions that have Attribute::AddressSafety
llvm-svn: 148846
2012-01-24 19:34:43 +00:00
Alexander Potapenko
bd636a5fe8 Implemented AddressSanitizer::getPassName()
llvm-svn: 148697
2012-01-23 11:22:43 +00:00
Kostya Serebryany
03444e57e8 [asan] extend the workaround for http://llvm.org/bugs/show_bug.cgi?id=11395: don't instrument the function at all on x86_32 if it has a large asm blob
llvm-svn: 147953
2012-01-11 18:15:23 +00:00
Kostya Serebryany
a7d1b796b9 [asan] cleanup: remove the SIGILL-related code (compiler part)
llvm-svn: 147667
2012-01-06 18:09:21 +00:00
Kostya Serebryany
847d2d2c25 [asan] add the name of the module to the description of a global variable. This improves the readability of global-buffer-overflow reports.
llvm-svn: 146698
2011-12-15 22:55:55 +00:00
Kostya Serebryany
65849ee22a [asan] fix a bug (issue 19) where dlclose and the following mmap caused a false positive. compiler part.
llvm-svn: 146688
2011-12-15 21:59:03 +00:00
Kostya Serebryany
7d3cbe255e [asan] remove .preinit_array from the compiler module (it breaks .so builds). This should be done in the run-time.
llvm-svn: 146527
2011-12-14 00:01:51 +00:00
Kostya Serebryany
8c4be7b06e [asan] report an error if blacklist file contains a malformed regex. fixes asan issue 17
llvm-svn: 146503
2011-12-13 19:34:53 +00:00
Daniel Dunbar
30d6a45140 LLVMBuild: Remove trailing newline, which irked me.
llvm-svn: 146409
2011-12-12 19:48:00 +00:00
Kostya Serebryany
da73ce34a1 [asan] use .preinit_array only on linux
llvm-svn: 146379
2011-12-12 18:01:46 +00:00
Kostya Serebryany
e3281eff91 [asan] call __asan_init from .preinit_array. This simplifies __asan_init vs malloc chicken-and-egg situation on Android and probably on other flavours of Linux. Patch by eugenis@google.com.
llvm-svn: 146284
2011-12-09 22:09:32 +00:00
Nick Lewycky
d59dcc5ddb Expose a switch for the new gcov format.
llvm-svn: 145880
2011-12-06 00:29:13 +00:00
Kostya Serebryany
78bd9e81b4 [asan] two minor fixes: use UnreachableInst after the neverreturn function call; use report_fatal_error when blacklist file can not be found
llvm-svn: 145611
2011-12-01 18:54:53 +00:00
Daniel Dunbar
4e00f5f8fd build/CMake: Finish removal of add_llvm_library_dependencies.
llvm-svn: 145420
2011-11-29 19:25:30 +00:00
Nick Lewycky
f8210714b8 Place the "cfg checksum" around a test. This was recently added in April 2011 to
gcc, though I thought it was older (my gcc 4.4 has it as a local patch. Whoops!)
This fixes PR10589.

Also add some debugging statements.

Remove GcnoFiles, the mapping from CompilationUnit to raw_ostream. Now that we
start by iterating over each CU and descending into them, there's no need to
maintain a mapping.

llvm-svn: 145208
2011-11-27 23:22:20 +00:00