summaryrefslogtreecommitdiffstats
path: root/llvm/test/Instrumentation/MemorySanitizer
Commit message (Collapse)AuthorAgeFilesLines
...
* DI: Fold constant arguments into a single MDStringDuncan P. N. Exon Smith2014-10-021-11/+11
| | | | | | | | | | | | | This patch addresses the first stage of PR17891 by folding constant arguments together into a single MDString. Integers are stringified and a `\0` character is used as a separator. Part of PR17891. Note: I've attached my testcases upgrade scripts to the PR. If I've just broken your out-of-tree testcases, they might help. llvm-svn: 218914
* Move the complex address expression out of DIVariable and into an extraAdrian Prantl2014-10-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | argument of the llvm.dbg.declare/llvm.dbg.value intrinsics. Previously, DIVariable was a variable-length field that has an optional reference to a Metadata array consisting of a variable number of complex address expressions. In the case of OpPiece expressions this is wasting a lot of storage in IR, because when an aggregate type is, e.g., SROA'd into all of its n individual members, the IR will contain n copies of the DIVariable, all alike, only differing in the complex address reference at the end. By making the complex address into an extra argument of the dbg.value/dbg.declare intrinsics, all of the pieces can reference the same variable and the complex address expressions can be uniqued across the CU, too. Down the road, this will allow us to move other flags, such as "indirection" out of the DIVariable, too. The new intrinsics look like this: declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr) declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr) This patch adds a new LLVM-local tag to DIExpressions, so we can detect and pretty-print DIExpression metadata nodes. What this patch doesn't do: This patch does not touch the "Indirect" field in DIVariable; but moving that into the expression would be a natural next step. http://reviews.llvm.org/D4919 rdar://problem/17994491 Thanks to dblaikie and dexonsmith for reviewing this patch! Note: I accidentally committed a bogus older version of this patch previously. llvm-svn: 218787
* Revert r218778 while investigating buldbot breakage.Adrian Prantl2014-10-011-3/+3
| | | | | | "Move the complex address expression out of DIVariable and into an extra" llvm-svn: 218782
* Move the complex address expression out of DIVariable and into an extraAdrian Prantl2014-10-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | argument of the llvm.dbg.declare/llvm.dbg.value intrinsics. Previously, DIVariable was a variable-length field that has an optional reference to a Metadata array consisting of a variable number of complex address expressions. In the case of OpPiece expressions this is wasting a lot of storage in IR, because when an aggregate type is, e.g., SROA'd into all of its n individual members, the IR will contain n copies of the DIVariable, all alike, only differing in the complex address reference at the end. By making the complex address into an extra argument of the dbg.value/dbg.declare intrinsics, all of the pieces can reference the same variable and the complex address expressions can be uniqued across the CU, too. Down the road, this will allow us to move other flags, such as "indirection" out of the DIVariable, too. The new intrinsics look like this: declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr) declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr) This patch adds a new LLVM-local tag to DIExpressions, so we can detect and pretty-print DIExpression metadata nodes. What this patch doesn't do: This patch does not touch the "Indirect" field in DIVariable; but moving that into the expression would be a natural next step. http://reviews.llvm.org/D4919 rdar://problem/17994491 Thanks to dblaikie and dexonsmith for reviewing this patch! llvm-svn: 218778
* Revert r215415 which causse MSan to crash on a great deal of C++ code.Chandler Carruth2014-08-131-13/+0
| | | | | | I've followed up on the original commit as well. llvm-svn: 215532
* msan: Handle musttail callsReid Kleckner2014-08-121-0/+13
| | | | | | | | | | | | | | | | First, avoid calling setTailCall(false) on musttail calls. The funciton prototypes should be "congruent", so the shadow layout should be exactly the same. Second, avoid inserting instrumentation after a musttail call to propagate the return value shadow. We don't need to propagate the result of a tail call, it should already be in the right place. Reviewed By: eugenis Differential Revision: http://reviews.llvm.org/D4331 llvm-svn: 215415
* [msan] Fix handling of array types.Evgeniy Stepanov2014-07-311-0/+89
| | | | | | | | Switch array type shadow from a single integer to an array of integers (i.e. make it per-element). This simplifies instrumentation of extractvalue and fixes PR20493. llvm-svn: 214398
* [msan] Avoid redundant origin stores.Evgeniy Stepanov2014-07-171-0/+18
| | | | | | | | | | | | | Origin is meaningless for fully initialized values. Avoid storing origin for function arguments that are known to be always initialized (i.e. shadow is a compile-time null constant). This is not about correctness, but purely an optimization. Seems to affect compilation time of blacklisted functions significantly. llvm-svn: 213239
* [msan] Fix handling of phi in blacklisted functions.Evgeniy Stepanov2014-07-071-0/+23
| | | | llvm-svn: 212454
* [msan] Stop propagating shadow in blacklisted functions.Evgeniy Stepanov2014-07-031-5/+3
| | | | | | | | | | | | | | With this change all values passed through blacklisted functions become fully initialized. Previous behavior was to initialize all loads in blacklisted functions, but apply normal shadow propagation logic for all other operation. This makes blacklist applicable in a wider range of situations. It also makes code for blacklisted functions a lot shorter, which works as yet another workaround for PR17409. llvm-svn: 212268
* [msan] Add missing attributes in MemorySanitizer tests.Evgeniy Stepanov2014-07-033-7/+7
| | | | llvm-svn: 212267
* msan: Stop stripping the 'tail' modifier off of callsReid Kleckner2014-06-301-0/+14
| | | | | | | This probably isn't necessary since msan started to unpoison the return value shadow memory before all calls. llvm-svn: 212061
* [msan] Fix bad interaction between with-calls mode and chained origin tracking.Evgeniy Stepanov2014-06-251-0/+6
| | | | | | | | | | Origin history should only be recorded for uninitialized values, because it is meaningless otherwise. This change moves __msan_chain_origin to the runtime library side and makes it conditional on the corresponding shadow value. Previous code was correct, but _very_ inefficient. llvm-svn: 211700
* [msan] Handle X86 *.psad.* and *.pmadd.* intrinsics.Evgeniy Stepanov2014-06-181-0/+65
| | | | llvm-svn: 211156
* [msan] Fix handling of multiplication by a constant with a number of ↵Evgeniy Stepanov2014-06-171-0/+94
| | | | | | | | | | | | | | | | | | | trailing zeroes. Multiplication by an integer with a number of trailing zero bits leaves the same number of lower bits of the result initialized to zero. This change makes MSan take this into account in the case of multiplication by a compile-time constant. We don't handle the general, non-constant, case because (a) it's not going to be cheap (computation-wise); (b) multiplication by a partially uninitialized value in user code is a bad idea anyway. Constant case must be handled because it appears from LLVM optimization of a completely valid user code, as the test case in compiler-rt demonstrates. llvm-svn: 211092
* IR: add "cmpxchg weak" variant to support permitted failure.Tim Northover2014-06-131-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a weak variant of the cmpxchg operation, as described in C++11. A cmpxchg instruction with this modifier is permitted to fail to store, even if the comparison indicated it should. As a result, cmpxchg instructions must return a flag indicating success in addition to their original iN value loaded. Thus, for uniformity *all* cmpxchg instructions now return "{ iN, i1 }". The second flag is 1 when the store succeeded. At the DAG level, a new ATOMIC_CMP_SWAP_WITH_SUCCESS node has been added as the natural representation for the new cmpxchg instructions. It is a strong cmpxchg. By default this gets Expanded to the existing ATOMIC_CMP_SWAP during Legalization, so existing backends should see no change in behaviour. If they wish to deal with the enhanced node instead, they can call setOperationAction on it. Beware: as a node with 2 results, it cannot be selected from TableGen. Currently, no use is made of the extra information provided in this patch. Test updates are almost entirely adapting the input IR to the new scheme. Summary for out of tree users: ------------------------------ + Legacy Bitcode files are upgraded during read. + Legacy assembly IR files will be invalid. + Front-ends must adapt to different type for "cmpxchg". + Backends should be unaffected by default. llvm-svn: 210903
* Fix test in r210472.Evgeniy Stepanov2014-06-091-1/+1
| | | | llvm-svn: 210473
* [msan] Workaround for invalid origins in shufflevector.Evgeniy Stepanov2014-06-091-0/+19
| | | | | | | | | Makes origin propagation ignore literal undef operands, and, in general, any operand we don't have origin for. https://code.google.com/p/memory-sanitizer/issues/detail?id=56 llvm-svn: 210472
* [msan] Fix vector pack intrinsic handling.Evgeniy Stepanov2014-06-091-1/+23
| | | | | | | | | This fixes a crash on MMX intrinsics, as well as a corner case in handling of all unsigned pack intrinsics. PR19953. llvm-svn: 210454
* [msan] Handle x86 vector pack intrinsics.Evgeniy Stepanov2014-06-021-0/+38
| | | | llvm-svn: 210020
* [msan] Fix -fsanitize=memory -fno-integrated-as.Evgeniy Stepanov2014-05-071-0/+21
| | | | llvm-svn: 208211
* [msan] Add -msan-instrumentation-with-call-threshold.Evgeniy Stepanov2014-04-181-0/+47
| | | | | | | | | This flag replaces inline instrumentation for checks and origin stores with calls into MSan runtime library. This is a workaround for PR17409. Disabled by default. llvm-svn: 206585
* [msan] Relax the test some more.Evgeniy Stepanov2014-03-251-12/+12
| | | | | | This may or may not fix the bots. R204720 did not. llvm-svn: 204721
* [msan] Make some tests less strict.Evgeniy Stepanov2014-03-251-8/+8
| | | | | | This may or may not fix the bots. llvm-svn: 204720
* [msan] More precise instrumentation of select IR.Evgeniy Stepanov2014-03-251-15/+33
| | | | | | | | | Some bits of select result may be initialized even if select condition is not. https://code.google.com/p/memory-sanitizer/issues/detail?id=50 llvm-svn: 204716
* Set debug info for instructions inserted in SplitBlockAndInsertIfThen.Evgeniy Stepanov2014-03-191-9/+48
| | | | llvm-svn: 204230
* [msan] Origin tracking with history.Evgeniy Stepanov2014-03-181-0/+34
| | | | | | | | LLVM part of MSan implementation of advanced origin tracking, when we record not only creation point, but all locations where an uninitialized value was stored to memory, too. llvm-svn: 204151
* [msan] Fix handling of byval arguments in VarArg calls.Evgeniy Stepanov2014-03-131-0/+42
| | | | llvm-svn: 203794
* IR: add a second ordering operand to cmpxhg for failureTim Northover2014-03-111-5/+5
| | | | | | | | | | | | | | | The syntax for "cmpxchg" should now look something like: cmpxchg i32* %addr, i32 42, i32 3 acquire monotonic where the second ordering argument gives the required semantics in the case that no exchange takes place. It should be no stronger than the first ordering constraint and cannot be either "release" or "acq_rel" (since no store will have taken place). rdar://problem/15996804 llvm-svn: 203559
* [msan] Handle X86 SIMD bitshift intrinsics.Evgeniy Stepanov2014-03-031-0/+100
| | | | llvm-svn: 202712
* Add an explicit insert point argument to SplitBlockAndInsertIfThen.Evgeniy Stepanov2013-12-191-3/+29
| | | | | | | | Currently SplitBlockAndInsertIfThen requires that branch condition is an Instruction itself, which is very inconvenient, because it is sometimes an Operator, or even a Constant. llvm-svn: 197677
* [msan] Propagate condition origin in select instruction.Evgeniy Stepanov2013-11-211-0/+7
| | | | llvm-svn: 195349
* Use multiple filecheck prefixes in msan instrumentation tests.Evgeniy Stepanov2013-11-212-72/+57
| | | | llvm-svn: 195342
* [msan] Use CHECK-DAG instead of CHECK where order of instructions does not ↵Evgeniy Stepanov2013-11-141-2/+2
| | | | | | | | matter. This may fix hexagon-elf bots. llvm-svn: 194700
* [msan] Fast path optimization for wrap-indirect-calls feature of ↵Evgeniy Stepanov2013-11-141-2/+15
| | | | | | | | | | | | | | | | | | | MemorySanitizer. Indirect call wrapping helps MSanDR (dynamic instrumentation companion tool for MSan) to catch all cases where execution leaves a compiler-instrumented module by allowing the tool to rewrite targets of indirect calls. This change is an optimization that skips wrapping for calls when target is inside the current module. This relies on the linker providing symbols at the begin and end of the module code (or code + data, does not really matter). Gold linker provides such symbols by default. GNU (BFD) linker needs a link flag: -Wl,--defsym=__executable_start=0. More info: https://code.google.com/p/memory-sanitizer/wiki/MSanDR#Native_exec llvm-svn: 194697
* [msan] Propagate origin for insertvalue, extractvalue.Evgeniy Stepanov2013-11-111-0/+26
| | | | llvm-svn: 194374
* [msan] Instrument x86.*_cvt* intrinsics.Evgeniy Stepanov2013-10-141-0/+66
| | | | | | | | Currently MSan checks that arguments of *cvt* intrinsics are fully initialized. That's too much to ask: some of them only operate on lower half, or even quarter, of the input register. llvm-svn: 192599
* [msan] Fix handling of scalar select of vectors.Evgeniy Stepanov2013-10-141-0/+19
| | | | llvm-svn: 192575
* [msan] Handling of atomic load/store, atomic rmw, cmpxchg.Evgeniy Stepanov2013-09-242-4/+193
| | | | llvm-svn: 191287
* [msan] Wrap indirect functions.Evgeniy Stepanov2013-09-191-0/+21
| | | | | | | | | Adds a flag to the MemorySanitizer pass that enables runtime rewriting of indirect calls. This is part of MSanDR implementation and is needed to return control to the DynamiRio-based helper tool on transition between instrumented and non-instrumented modules. Disabled by default. llvm-svn: 191006
* [msan] Check return value of main().Evgeniy Stepanov2013-09-161-0/+18
| | | | llvm-svn: 190782
* [msan] Fix handling of select with struct arguments.Evgeniy Stepanov2013-09-031-0/+13
| | | | llvm-svn: 189796
* [msan] Fix select instrumentation.Evgeniy Stepanov2013-09-031-0/+9
| | | | | | | Select condition shadow was being ignored resulting in false negatives. This change OR-s sign-extended condition shadow into the result shadow. llvm-svn: 189785
* [msan] Fix handling of va_arg overflow area on x86_64.Evgeniy Stepanov2013-08-231-0/+25
| | | | | | | | The code was erroneously reading overflow area shadow from the TLS slot, bypassing the local copy. Reading shadow directly from TLS is wrong, because it can be overwritten by a nested vararg call, if that happens before va_start. llvm-svn: 189104
* [tests] Cleanup initialization of test suffixes.Daniel Dunbar2013-08-161-1/+0
| | | | | | | | | | | | | | | | | - Instead of setting the suffixes in a bunch of places, just set one master list in the top-level config. We now only modify the suffix list in a few suites that have one particular unique suffix (.ml, .mc, .yaml, .td, .py). - Aside from removing the need for a bunch of lit.local.cfg files, this enables 4 tests that were inadvertently being skipped (one in Transforms/BranchFolding, a .s file each in DebugInfo/AArch64 and CodeGen/PowerPC, and one in CodeGen/SI which is now failing and has been XFAILED). - This commit also fixes a bunch of config files to use config.root instead of older copy-pasted code. llvm-svn: 188513
* [msan] Unpoison stack allocations and undef values in blacklisted functions.Evgeniy Stepanov2013-07-031-0/+35
| | | | | | | This changes behavior of -msan-poison-stack=0 flag from not poisoning stack allocations to actively unpoisoning them. llvm-svn: 185538
* [msan] Handle mixed track-origins and keep-going settings (llvm part).Evgeniy Stepanov2013-05-311-2/+3
| | | | | | | | | | | | | Before this change, each module defined a weak_odr global __msan_track_origins with a value of 1 if origin tracking is enabled, 0 if disabled. If there are modules with different values, any of them may win. If 0 wins, and there is at least one module with 1, the program will most likely crash. With this change, __msan_track_origins is only emitted if origin tracking is on. Then runtime library detects if there is at least one module with origin tracking, and enables runtime support for it. llvm-svn: 182997
* [msan] Fix argument shadow alignment.Evgeniy Stepanov2013-05-281-0/+40
| | | | llvm-svn: 182771
* [msan] A no-op implementation of VarArg handling.Evgeniy Stepanov2013-05-212-0/+16
| | | | | | | This stuff is used on platforms where MSan does not have a proper VarArg implementation (anything other than x86_64 at the moment). llvm-svn: 182375
* [msan] Switch TLS globals to initial-exec model.Evgeniy Stepanov2013-05-161-1/+10
| | | | | | They are always defined in the main executable. llvm-svn: 181994
OpenPOWER on IntegriCloud