summaryrefslogtreecommitdiff
path: root/lib/Transforms/Instrumentation
Commit message (Collapse)AuthorAge
* Fix a documentation warning: \bried -> \briefDmitri Gribenko2013-05-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181551 91177308-0d34-0410-b5e6-96231b3b80d8
* Add DebugIR pass -- emits IR file and replace source lines with IR lines in MDDaniel Malea2013-05-08
| | | | | | | | | | | | | - requires existing debug information to be present - fixes up file name and line number information in metadata - emits a "<orig_filename>-debug.ll" succinct IR file (without !dbg metadata or debug intrinsics) that can be read by a debugger - initialize pass in opt tool to enable the "-debug-ir" flag - lit tests to follow git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181467 91177308-0d34-0410-b5e6-96231b3b80d8
* This patch breaks up Wrap.h so that it does not have to include all of Filip Pizlo2013-05-01
| | | | | | | | | | | | | | | | | | | | | | | | | | the things, and renames it to CBindingWrapping.h. I also moved CBindingWrapping.h into Support/. This new file just contains the macros for defining different wrap/unwrap methods. The calls to those macros, as well as any custom wrap/unwrap definitions (like for array of Values for example), are put into corresponding C++ headers. Doing this required some #include surgery, since some .cpp files relied on the fact that including Wrap.h implicitly caused the inclusion of a bunch of other things. This also now means that the C++ headers will include their corresponding C API headers; for example Value.h must include llvm-c/Core.h. I think this is harmless, since the C API headers contain just external function declarations and some C types, so I don't believe there should be any nasty dependency issues here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180881 91177308-0d34-0410-b5e6-96231b3b80d8
* Move C++ code out of the C headers and into either C++ headersEric Christopher2013-04-22
| | | | | | | or the C++ files themselves. This enables people to use just a C compiler to interoperate with LLVM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180063 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASan] Allow disabling init-order checks for globals by source file name.Alexey Samsonov2013-04-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179280 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor simplification.Bill Wendling2013-03-28
| | | | | | | Go ahead and use the full path for both the .gcno and .gcda files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178302 91177308-0d34-0410-b5e6-96231b3b80d8
* [tsan] make sure memset/memcpy/memmove are not inlined in tsan modeKostya Serebryany2013-03-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178230 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the full path when outputting the `.gcda' file.Bill Wendling2013-03-26
| | | | | | | | | | | | | | | If we compile a single source program, the `.gcda' file will be generated where the program was executed. This isn't desirable, because that place may be at an unpredictable place (the program could call `chdir' for instance). Instead, we will output the `.gcda' file in the same place we output the `.gcno' file. I.e., the directory where the executable was generated. This matches GCC's behavior. <rdar://problem/13061072> & PR11809 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178084 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASan] Change the ABI of __asan_before_dynamic_init function: now it takes ↵Alexey Samsonov2013-03-26
| | | | | | pointer to private string with module name. This string serves as a unique module ID in ASan runtime. LLVM part git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178013 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Change the way we report the alloca frame on stack-buff-overflow.Kostya Serebryany2013-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: the function name was stored by the compiler as a constant string and the run-time was printing it. Now: the PC is stored instead and the run-time prints the full symbolized frame. This adds a couple of instructions into every function with non-empty stack frame, but also reduces the binary size because we store less strings (I saw 2% size reduction). This change bumps the asan ABI version to v3. llvm part. Example of report (now): ==31711==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffa77cf1c5 at pc 0x41feb0 bp 0x7fffa77cefb0 sp 0x7fffa77cefa8 READ of size 1 at 0x7fffa77cf1c5 thread T0 #0 0x41feaf in Frame0(int, char*, char*, char*) stack-oob-frames.cc:20 #1 0x41f7ff in Frame1(int, char*, char*) stack-oob-frames.cc:24 #2 0x41f477 in Frame2(int, char*) stack-oob-frames.cc:28 #3 0x41f194 in Frame3(int) stack-oob-frames.cc:32 #4 0x41eee0 in main stack-oob-frames.cc:38 #5 0x7f0c5566f76c (/lib/x86_64-linux-gnu/libc.so.6+0x2176c) #6 0x41eb1c (/usr/local/google/kcc/llvm_cmake/a.out+0x41eb1c) Address 0x7fffa77cf1c5 is located in stack of thread T0 at offset 293 in frame #0 0x41f87f in Frame0(int, char*, char*, char*) stack-oob-frames.cc:12 <<<<<<<<<<<<<< this is new This frame has 6 object(s): [32, 36) 'frame.addr' [96, 104) 'a.addr' [160, 168) 'b.addr' [224, 232) 'c.addr' [288, 292) 's' [352, 360) 'd' git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177724 91177308-0d34-0410-b5e6-96231b3b80d8
* tsan: handle vptr loads speciallyDmitry Vyukov2013-03-22
| | | | | | | | | This is required to determine ctor/dtor vs virtual call races. http://llvm-reviews.chandlerc.com/D566 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177717 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Add an option to disable poisoning of shadow for undef values.Evgeniy Stepanov2013-03-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177630 91177308-0d34-0410-b5e6-96231b3b80d8
* Call the new llvm_gcov_init function to register the environment.Bill Wendling2013-03-20
| | | | | | | | | | | | Use the new `llvm_gcov_init' function to register the writeout and flush functions. The initialization function will also call `atexit' for some cleanups and final writout calls. But it does this only once. This is better than checking for the `main' function, because in a library that function may not exist. <rdar://problem/12439551> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177579 91177308-0d34-0410-b5e6-96231b3b80d8
* Register the GCOV writeout functions so that they're emitted serially.Bill Wendling2013-03-19
| | | | | | | | | | We don't want to write out >1000 files at the same time. That could make things prohibitively expensive. Instead, register the "writeout" function so that it's emitted serially. <rdar://problem/12439551> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177437 91177308-0d34-0410-b5e6-96231b3b80d8
* Emit the linkage name instead of the function name, when available. This meansNick Lewycky2013-03-19
| | | | | | | that we'll prefer to emit the mangled C++ name (pending a clang change). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177371 91177308-0d34-0410-b5e6-96231b3b80d8
* Register the flush function for each compile unit.Bill Wendling2013-03-18
| | | | | | | | | | | For each compile unit, we want to register a function that will flush that compile unit. Otherwise, __gcov_flush() would only flush the counters within the current compile unit, and not any outside of it. PR15191 & <rdar://problem/13167507> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177340 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] when creating string constants, set unnamed_attr and align 1 so that ↵Kostya Serebryany2013-03-18
| | | | | | equal strings are merged by the linker. Observed up to 1% binary size reduction. Thanks to Anton Korobeynikov for the suggestion git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177264 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] while generating the description of a global variable, emit the ↵Kostya Serebryany2013-03-18
| | | | | | module name in a separate field, thus not duplicating this information if every description. This decreases the binary size (observed up to 3%). https://code.google.com/p/address-sanitizer/issues/detail?id=168 . This changes the asan API version. llvm-part git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177254 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] don't instrument functions with available_externally linkage. This ↵Kostya Serebryany2013-03-18
| | | | | | saves a bit of compile time and reduces the number of redundant global strings generated by asan (https://code.google.com/p/address-sanitizer/issues/detail?id=167) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177250 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASan] emit instrumentation for initialization order checking by defaultAlexey Samsonov2013-03-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177063 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove accidentally committed debug line.Nick Lewycky2013-03-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177005 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor GCOV's six constructor arguments into a struct with a getter thatNick Lewycky2013-03-14
| | | | | | | | | | | constructs default arguments. It can now take default arguments from cl::opt'ions. Add a new -default-gcov-version=... option, and actually test it! Sink the reverse-order of the version into GCOVProfiling, hiding it from our users. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177002 91177308-0d34-0410-b5e6-96231b3b80d8
* No functionality change. Rename emitGCNO() to the more sensibleNick Lewycky2013-03-13
| | | | | | | | | | emitProfileNotes(), similar to emitProfileArcs(). Also update its comment. Also add a comment on Version[4] (there will be another comment in clang later), and compress lines that exceeded 80 columns. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176994 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the correct index variable. This is the meat of what was supposed to be inNick Lewycky2013-03-09
| | | | | | | r176751. Also, learn a lesson about applying patches by hand/eyeball. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176764 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix bug introduced in r176616 when making function identifier numbers stable.Nick Lewycky2013-03-09
| | | | | | | Count the subprograms, not the compile units. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176751 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't emit the extra checksum into the .gcda file if the user hasn't asked forNick Lewycky2013-03-09
| | | | | | | | | it. Fortunately, versions of gcov that predate the extra checksum also ignore any extra data, so this isn't a problem. There will be a matching commit in compiler-rt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176745 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch from a version 4.2/4.4 switch to a four-byte version string to be putNick Lewycky2013-03-07
| | | | | | | | | | into the actual gcov file. Instead of using the bottom 4 bytes as the function identifier, use a counter. This makes the identifier numbers stable across multiple runs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176616 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Implement sanitize_memory attribute.Evgeniy Stepanov2013-02-28
| | | | | | | | | | | Shadow checks are disabled and memory loads always produce fully initialized values in functions that don't have a sanitize_memory attribute. Value and argument shadow is propagated as usual. This change also updates blacklist behaviour to match the above. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176247 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused leftover declarations.Evgeniy Stepanov2013-02-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176240 91177308-0d34-0410-b5e6-96231b3b80d8
* In GCC 4.7, function names are now forbidden from .gcda files. Support this byNick Lewycky2013-02-27
| | | | | | | | passing a null pointer to the function name in to GCDAProfiling, and add another switch onto GCOVProfiling. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176173 91177308-0d34-0410-b5e6-96231b3b80d8
* Doh, fix behaviour change introduced in r176168 which is tested in clang,Nick Lewycky2013-02-27
| | | | | | | not llvm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176172 91177308-0d34-0410-b5e6-96231b3b80d8
* IRBuilder has grown all sorts of useful utility functions. Make use of them toNick Lewycky2013-02-27
| | | | | | | clean up this code a tiny bit. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176168 91177308-0d34-0410-b5e6-96231b3b80d8
* Unify clang/llvm attributes for asan/tsan/msan (LLVM part)Kostya Serebryany2013-02-26
| | | | | | | | | | | | | | | | | | | | These are two related changes (one in llvm, one in clang). LLVM: - rename address_safety => sanitize_address (the enum value is the same, so we preserve binary compatibility with old bitcode) - rename thread_safety => sanitize_thread - rename no_uninitialized_checks -> sanitize_memory CLANG: - add __attribute__((no_sanitize_address)) as a synonym for __attribute__((no_address_safety_analysis)) - add __attribute__((no_sanitize_thread)) - add __attribute__((no_sanitize_memory)) for S in address thread memory If -fsanitize=S is present and __attribute__((no_sanitize_S)) is not set llvm attribute sanitize_S git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176075 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] instrument invoke insns with noreturn attribute (as well as call insns)Kostya Serebryany2013-02-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175617 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] instrument memory accesses with unusual sizesKostya Serebryany2013-02-19
| | | | | | | | | | | | | | | | | | | This patch makes asan instrument memory accesses with unusual sizes (e.g. 5 bytes or 10 bytes), e.g. long double or packed structures. Instrumentation is done with two 1-byte checks (first and last bytes) and if the error is found __asan_report_load_n(addr, real_size) or __asan_report_store_n(addr, real_size) is called. Also, call these two new functions in memset/memcpy instrumentation. asan-rt part will follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175507 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] revert r175266 as it breaks code with packed structures. supporting ↵Kostya Serebryany2013-02-18
| | | | | | long double will require a more general solution git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175442 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] support long double on 64-bit. See ↵Kostya Serebryany2013-02-15
| | | | | | https://code.google.com/p/address-sanitizer/issues/detail?id=151 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175266 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] fix confusing indentationKostya Serebryany2013-02-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175033 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASan] Do not use kDefaultShort64bitShadowOffset on Mac, where the binaries ↵Alexander Potapenko2013-02-12
| | | | | | may get mapped at 0x100000000+ and thus may interleave with the shadow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174964 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] change the default mapping offset on x86_64 to 0x7fff8000. This gives ↵Kostya Serebryany2013-02-12
| | | | | | roughly 5% speedup. Since this is an ABI change, bump the asan ABI version by renaming __asan_init to __asan_init_v1. llvm part, compiler-rt part will follow git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174957 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] added a flag -mllvm asan-short-64bit-mapping-offset=1 (0 by default)Kostya Serebryany2013-02-11
| | | | | | | | | | | This flag makes asan use a small (<2G) offset for 64-bit asan shadow mapping. On x86_64 this saves us a register, thus achieving ~2/3 of the zero-base-offset's benefits in both performance and code size. Thanks Jakub Jelinek for the idea. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174886 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Add LLVMContext::emitWarning methods and use them. ↵Bob Wilson2013-02-08
| | | | | | | | | | | | | <rdar://problem/12867368>" This reverts r171041. This was a nice idea that didn't work out well. Clang warnings need to be associated with warning groups so that they can be selectively disabled, promoted to errors, etc. This simplistic patch didn't allow for that. Enhancing it to provide some way for the backend to specify a front-end warning type seems like overkill for the few uses of this, at least for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174748 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing warnings revealed by gcc release buildEdwin Vane2013-01-29
| | | | | | | | | Fixed set-but-not-used warnings. Reviewer: gribozavr git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173810 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Mostly disable msan-handle-icmp-exact.Evgeniy Stepanov2013-01-28
| | | | | | | | | It is way too slow. Change the default option value to 0. Always do exact shadow propagation for unsigned ICmp with constants, it is cheap (under 1% cpu time) and required for correctness. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173682 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r173678.Evgeniy Stepanov2013-01-28
| | | | | | | Broken tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173679 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Make msan-handle-icmp-exact=0 by default.Evgeniy Stepanov2013-01-28
| | | | | | | 50% slowdown on one of the specs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173678 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] A comment on ICmp handling logic.Evgeniy Stepanov2013-01-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173453 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Implement exact shadow propagation for relational ICmp.Evgeniy Stepanov2013-01-25
| | | | | | | | | Only for integers, pointers, and vectors of those. No floats. Instrumentation seems very heavy, and may need to be replaced with some approximation in the future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173452 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] fix 32-bit buildsKostya Serebryany2013-01-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173338 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] adaptive redzones for globals (the larger the global the larger is ↵Kostya Serebryany2013-01-24
| | | | | | the redzone) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173335 91177308-0d34-0410-b5e6-96231b3b80d8