summaryrefslogtreecommitdiffstats
path: root/llvm/test/Instrumentation
Commit message (Collapse)AuthorAgeFilesLines
...
* DI: Fold constant arguments into a single MDStringDuncan P. N. Exon Smith2014-10-024-45/+45
| | | | | | | | | | | | | 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-014-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-014-15/+15
| | | | | | "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-014-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Introduce support for custom wrappers for vararg functions.Lorenzo Martignoni2014-09-301-4/+10
| | | | | | Differential Revision: http://reviews.llvm.org/D5412 llvm-svn: 218671
* [asan] don't instrument module CTORs that may be run before ↵Kostya Serebryany2014-09-241-5/+15
| | | | | | asan.module_ctor. This fixes asan running together -coverage llvm-svn: 218421
* [asan-assembly-instrumentation] Added CFI directives to the generated ↵Yuri Gorshenin2014-09-101-0/+45
| | | | | | | | | | | | | | instrumentation code. Summary: [asan-assembly-instrumentation] Added CFI directives to the generated instrumentation code. Reviewers: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5189 llvm-svn: 217482
* [asan] fix debug info produced for asan-coverage=2Kostya Serebryany2014-09-031-0/+75
| | | | llvm-svn: 217106
* [asan] add -asan-coverage=3: instrument all blocks and critical edges. Kostya Serebryany2014-09-031-0/+10
| | | | llvm-svn: 217098
* [asan] Assign a low branch weight to ASan's slow path, patch by Jonas ↵Kostya Serebryany2014-09-021-1/+3
| | | | | | Wagner. This speeds up asan (at least on SPEC) by 1%-5% or more. Also fix lint in dfsan. llvm-svn: 216972
* [asan-assembly-instrumentation] Prologue and epilogue are moved out from ↵Yuri Gorshenin2014-09-012-23/+49
| | | | | | | | | | | | InstrumentMemOperand(). Reviewers: eugenis Subscribers: llvm-commits Differential revision: http://reviews.llvm.org/D4923 llvm-svn: 216879
* Revert "[asan-assembly-instrumentation] Prologue and epilogue are moved out ↵Yuri Gorshenin2014-09-012-49/+23
| | | | | | | | from InstrumentMemOperand()." This reverts commit 895aa397038b8de86d83ac0997a70949a486e112. llvm-svn: 216872
* [asan-assembly-instrumentation] Prologue and epilogue are moved out from ↵Yuri Gorshenin2014-09-012-23/+49
| | | | | | InstrumentMemOperand(). llvm-svn: 216869
* [dfsan] Fix non-determinism bug in non-zero label check annotator.Peter Collingbourne2014-08-221-5/+8
| | | | | | | We now use a std::vector instead of a DenseSet to store the list of label checks so that we can iterate over it deterministically. llvm-svn: 216255
* [dfsan] Treat vararg custom functions like unimplemented functions.Peter Collingbourne2014-08-201-0/+6
| | | | | | | | | Because declarations of these functions can appear in places like autoconf checks, they have to be handled somehow, even though we do not support vararg custom functions. We do so by printing a warning and calling the uninstrumented function, as we do for unimplemented functions. llvm-svn: 216042
* 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
* [dfsan] Try not to create too many additional basic blocks in functions whichPeter Collingbourne2014-08-061-0/+3013
| | | | | | | already have a large number of blocks. Works around a performance issue with the greedy register allocator. llvm-svn: 214944
* [ASan] Use metadata to pass source-level information from Clang to ASan.Alexey Samsonov2014-08-021-22/+18
| | | | | | | | | | | | | | | | | Instead of creating global variables for source locations and global names, just create metadata nodes and strings. They will be transformed into actual globals in the instrumentation pass (if necessary). This approach is more flexible: 1) we don't have to ensure that our custom globals survive all the optimizations 2) if globals are discarded for some reason, we will simply ignore metadata for them and won't have to erase corresponding globals 3) metadata for source locations can be reused for other purposes: e.g. we may attach source location metadata to alloca instructions and provide better descriptions for stack variables in ASan error reports. No functionality change. llvm-svn: 214604
* [dfsan] Correctly handle loads and stores of zero size.Peter Collingbourne2014-08-012-1/+26
| | | | llvm-svn: 214561
* [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
* [asan] Support x86 REP MOVS asm instrumentation.Evgeniy Stepanov2014-07-312-0/+69
| | | | | | Patch by Yuri Gorshenin. llvm-svn: 214395
* [ASan] Don't instrument load/stores with !nosanitize metadata.Alexey Samsonov2014-07-171-0/+52
| | | | | | | | | This is used to avoid instrumentation of instructions added by UBSan in Clang frontend (see r213291). This fixes PR20085. Reviewed in http://reviews.llvm.org/D4544. llvm-svn: 213292
* [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
* CHECK-LABEL-ize one testAlexey Samsonov2014-07-161-7/+7
| | | | llvm-svn: 213177
* [dfsan] Introduce further optimization to reduce the number of union queries.Peter Collingbourne2014-07-151-4/+15
| | | | | | | Specifically, do not compute a union if it is statically known that one shadow set subsumes the other. llvm-svn: 213100
* [dfsan] Introduce an optimization to reduce the number of union queries.Peter Collingbourne2014-07-151-0/+41
| | | | | | | Specifically, when building a union query, if we are dominated by an identical query then use the result of that query instead. llvm-svn: 213047
* [ASan] Collect unmangled names of global variables in Clang to print them in ↵Alexey Samsonov2014-07-123-11/+19
| | | | | | | | | | | | | | | | | error reports. Currently ASan instrumentation pass creates a string with global name for each instrumented global (to include global names in the error report). Global name is already mangled at this point, and we may not be able to demangle it at runtime (e.g. there is no __cxa_demangle on Android). Instead, create a string with fully qualified global name in Clang, and pass it to ASan instrumentation pass in llvm.asan.globals metadata. If there is no metadata for some global, ASan will use the original algorithm. This fixes https://code.google.com/p/address-sanitizer/issues/detail?id=264. llvm-svn: 212872
* Add a test case for r212596Timur Iskhodzhanov2014-07-111-0/+14
| | | | llvm-svn: 212828
* [dfsan] Handle bitcast aliases.Peter Collingbourne2014-07-101-0/+8
| | | | llvm-svn: 212668
* [asan] Generate asm instrumentation in MC.Evgeniy Stepanov2014-07-075-91/+90
| | | | | | | | | Generate entire ASan asm instrumentation in MC without relying on runtime helper functions. Patch by Yuri Gorshenin. llvm-svn: 212455
* [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
* [ASan] Print exact source location of global variables in error reports.Alexey Samsonov2014-07-023-5/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://code.google.com/p/address-sanitizer/issues/detail?id=299 for the original feature request. Introduce llvm.asan.globals metadata, which Clang (or any other frontend) may use to report extra information about global variables to ASan instrumentation pass in the backend. This metadata replaces llvm.asan.dynamically_initialized_globals that was used to detect init-order bugs. llvm.asan.globals contains the following data for each global: 1) source location (file/line/column info); 2) whether it is dynamically initialized; 3) whether it is blacklisted (shouldn't be instrumented). Source location data is then emitted in the binary and can be picked up by ASan runtime in case it needs to print error report involving some global. For example: 0x... is located 4 bytes to the right of global variable 'C::array' defined in '/path/to/file:17:8' (0x...) of size 40 These source locations are printed even if the binary doesn't have any debug info. This is an ABI-breaking change. ASan initialization is renamed to __asan_init_v4(). Pre-built libraries compiled with older Clang will not work with the fresh runtime. llvm-svn: 212188
* 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
* Debug info: split out complex DIVariable address expressions into aAdrian Prantl2014-06-301-2/+3
| | | | | | | | | | | separate MDNode so they can be uniqued via folding set magic. To conserve space, DIVariable nodes are still variable-length, with the last two fields being optional. No functional change. http://reviews.llvm.org/D3526 llvm-svn: 212050
* IR: Add COMDATs to the IRDavid Majnemer2014-06-271-1/+1
| | | | | | | | | | | | | | | | This new IR facility allows us to represent the object-file semantic of a COMDAT group. COMDATs allow us to tie together sections and make the inclusion of one dependent on another. This is required to implement features like MS ABI VFTables and optimizing away certain kinds of initialization in C++. This functionality is only representable in COFF and ELF, Mach-O has no similar mechanism. Differential Revision: http://reviews.llvm.org/D4178 llvm-svn: 211920
* [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
* Remove top-level Clang -fsanitize= flags for optional ASan features.Alexey Samsonov2014-06-133-3/+3
| | | | | | | | | | | | | Init-order and use-after-return modes can currently be enabled by runtime flags. use-after-scope mode is not really working at the moment. The only problem I see is that users won't be able to disable extra instrumentation for init-order and use-after-scope by a top-level Clang flag. But this instrumentation was implicitly enabled for quite a while and we didn't hear from users hurt by it. llvm-svn: 210924
* 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
* Reduce verbiage of lit.local.cfg filesAlp Toker2014-06-091-2/+1
| | | | | | We can just split targets_to_build in one place and make it immutable. llvm-svn: 210496
* 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
* Allow aliases to be unnamed_addr.Rafael Espindola2014-06-061-1/+1
| | | | | | | | | | | | | | | | | | Alias with unnamed_addr were in a strange state. It is stored in GlobalValue, the language reference talks about "unnamed_addr aliases" but the verifier was rejecting them. It seems natural to allow unnamed_addr in aliases: * It is a property of how it is accessed, not of the data itself. * It is perfectly possible to write code that depends on the address of an alias. This patch then makes unname_addr legal for aliases. One side effect is that the syntax changes for a corner case: In globals, unnamed_addr is now printed before the address space. llvm-svn: 210302
* [asancov] Fix coverage line info some more.Evgeniy Stepanov2014-06-051-17/+51
| | | | | | | Now it should always point to the opening brace of the function (in -asan-coverage=1 mode). llvm-svn: 210266
* [asan] Fix coverage instrumentation with -asan-globals=0.Evgeniy Stepanov2014-06-031-0/+12
| | | | llvm-svn: 210103
OpenPOWER on IntegriCloud