summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation
Commit message (Collapse)AuthorAgeFilesLines
...
* New EH representation for MSVC compatibilityDavid Majnemer2015-07-101-0/+30
| | | | | | | | | | | | | | | Summary: This introduces new instructions neccessary to implement MSVC-compatible exception handling support. Most of the middle-end and none of the back-end haven't been audited or updated to take them into account. Reviewers: rnk, JosephTremoulet, reames, nlewycky, rjmccall Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11041 llvm-svn: 241888
* [SanitizerCoverage] Don't add instrumentation to unreachable blocks.Alexey Samsonov2015-06-301-0/+7
| | | | llvm-svn: 241127
* Tidy comment.Diego Novillo2015-06-291-1/+1
| | | | llvm-svn: 240987
* [ASan] Use llvm::getDISubprogram() to get function entry debug location.Alexey Samsonov2015-06-261-7/+3
| | | | | | | | It can be more robust than copying debug info from first non-alloca instruction in the entry basic block. We use the same strategy in coverage instrumentation. llvm-svn: 240738
* [asan] Do not instrument special purpose LLVM sections.Anna Zaks2015-06-251-0/+2
| | | | | | | | | | | | | | Do not instrument globals that are placed in sections containing "__llvm" in their name. This fixes a bug in ASan / PGO interoperability. ASan interferes with LLVM's PGO, which places its globals into a special section, which is memcpy-ed by the linker as a whole. When those goals are instrumented, ASan's memcpy wrapper reports an issue. http://reviews.llvm.org/D10541 llvm-svn: 240723
* [asan] Don't run stack malloc on functions containing inline assembly.Anna Zaks2015-06-251-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | It makes LLVM run out of registers even on 64-bit platforms. For example, the following test case fails on darwin. clang -cc1 -O0 -triple x86_64-apple-macosx10.10.0 -emit-obj -fsanitize=address -mstackrealign -o ~/tmp/ex.o -x c ex.c error: inline assembly requires more registers than available void TestInlineAssembly(const unsigned char *S, unsigned int pS, unsigned char *D, unsigned int pD, unsigned int h) { unsigned int sr = 4, pDiffD = pD - 5; unsigned int pDiffS = (pS << 1) - 5; char flagSA = ((pS & 15) == 0), flagDA = ((pD & 15) == 0); asm volatile ( "mov %0, %%"PTR_REG("si")"\n" "mov %2, %%"PTR_REG("cx")"\n" "mov %1, %%"PTR_REG("di")"\n" "mov %8, %%"PTR_REG("ax")"\n" : : "m" (S), "m" (D), "m" (pS), "m" (pDiffS), "m" (pDiffD), "m" (sr), "m" (flagSA), "m" (flagDA), "m" (h) : "%"PTR_REG("si"), "%"PTR_REG("di"), "%"PTR_REG("ax"), "%"PTR_REG("cx"), "%"PTR_REG("dx"), "memory" ); } http://reviews.llvm.org/D10719 llvm-svn: 240722
* Teach LLVM about the PPC64 memory sanitizer implementation.Jay Foad2015-06-251-0/+17
| | | | | | | | | | | | | | | | Summary: This is the LLVM part of the PPC memory sanitizer implementation in D10648. Reviewers: kcc, samsonov, willschm, wschmidt, eugenis Reviewed By: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10649 llvm-svn: 240627
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-233-4/+4
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* SafeStack: Create the unsafe stack pointer on demand.Peter Collingbourne2015-06-221-3/+4
| | | | | | | This avoids creating an unnecessary undefined reference on targets such as NVPTX that require such references to be declared in asm output. llvm-svn: 240321
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-193-4/+4
| | | | | | | | | | | | | The patch is generated using this command: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ llvm/lib/ Thanks to Eugene Kosov for the original patch! llvm-svn: 240137
* [ASan] Initial support for Kernel AddressSanitizerAlexander Potapenko2015-06-191-42/+61
| | | | | | | | | This patch adds initial support for the -fsanitize=kernel-address flag to Clang. Right now it's quite restricted: only out-of-line instrumentation is supported, globals are not instrumented, some GCC kasan flags are not supported. Using this patch I am able to build and boot the KASan tree with LLVMLinux patches from github.com/ramosian-glider/kasan/tree/kasan_llvmlinux. To disable KASan instrumentation for a certain function attribute((no_sanitize("kernel-address"))) can be used. llvm-svn: 240131
* AVX-512: cvtusi2ss/d intrinsics.Igor Breger2015-06-171-0/+2
| | | | | | | | | Change builtin function name and signature ( add third parameter - rounding mode ). Added tests for intrinsics. Differential Revision: http://reviews.llvm.org/D10473 llvm-svn: 239888
* Protection against stack-based memory corruption errors using SafeStackPeter Collingbourne2015-06-153-0/+610
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the safe stack instrumentation pass to LLVM, which separates the program stack into a safe stack, which stores return addresses, register spills, and local variables that are statically verified to be accessed in a safe way, and the unsafe stack, which stores everything else. Such separation makes it much harder for an attacker to corrupt objects on the safe stack, including function pointers stored in spilled registers and return addresses. You can find more information about the safe stack, as well as other parts of or control-flow hijack protection technique in our OSDI paper on code-pointer integrity (http://dslab.epfl.ch/pubs/cpi.pdf) and our project website (http://levee.epfl.ch). The overhead of our implementation of the safe stack is very close to zero (0.01% on the Phoronix benchmarks). This is lower than the overhead of stack cookies, which are supported by LLVM and are commonly used today, yet the security guarantees of the safe stack are strictly stronger than stack cookies. In some cases, the safe stack improves performance due to better cache locality. Our current implementation of the safe stack is stable and robust, we used it to recompile multiple projects on Linux including Chromium, and we also recompiled the entire FreeBSD user-space system and more than 100 packages. We ran unit tests on the FreeBSD system and many of the packages and observed no errors caused by the safe stack. The safe stack is also fully binary compatible with non-instrumented code and can be applied to parts of a program selectively. This patch is our implementation of the safe stack on top of LLVM. The patches make the following changes: - Add the safestack function attribute, similar to the ssp, sspstrong and sspreq attributes. - Add the SafeStack instrumentation pass that applies the safe stack to all functions that have the safestack attribute. This pass moves all unsafe local variables to the unsafe stack with a separate stack pointer, whereas all safe variables remain on the regular stack that is managed by LLVM as usual. - Invoke the pass as the last stage before code generation (at the same time the existing cookie-based stack protector pass is invoked). - Add unit tests for the safe stack. Original patch by Volodymyr Kuznetsov and others at the Dependable Systems Lab at EPFL; updates and upstreaming by myself. Differential Revision: http://reviews.llvm.org/D6094 llvm-svn: 239761
* [ASan] format AddressSanitizer.cpp with `clang-format -style=Google`, NFCAlexander Potapenko2015-06-121-12/+8
| | | | llvm-svn: 239601
* [SanitizerCoverage] Use llvm::getDISubprogram() to get location of the entry ↵Alexey Samsonov2015-06-121-3/+9
| | | | | | | | | | | basic block. DebugLoc::getFnDebugLoc() should soon be removed. Also, getDISubprogram() might become more effective soon and wouldn't need to scan debug locations at all, if function-level metadata would be emitted by Clang. llvm-svn: 239586
* [asan] Prevent __attribute__((annotate)) triggering errors on DarwinAnna Zaks2015-06-091-14/+14
| | | | | | | | | | | | | | | | | The following code triggers a fatal error in the compiler instrumentation of ASan on Darwin because we place the attribute into llvm.metadata section, which does not have the proper MachO section name. void foo() __attribute__((annotate("custom"))); void foo() {;} This commit reorders the checks so that we skip everything in llvm.metadata first. It also removes the hard failure in case the section name does not parse. That check will be done lower in the compilation pipeline anyway. (Reviewed in http://reviews.llvm.org/D9093.) llvm-svn: 239379
* Tidy code in InstrProfiling.cpp. NFC.Diego Novillo2015-06-041-8/+8
| | | | | | | | | Removed the redundant "llvm::" from class names in InstrProfiling.cpp clang-format is ran on the changes. Patch from Betul Buyukkurt. llvm-svn: 239034
* [ASan] Fix previous commit. Patch by Max Ostapenko!Yury Gribov2015-05-281-4/+4
| | | | llvm-svn: 238403
* [ASan] New approach to dynamic allocas unpoisoning. Patch by Max Ostapenko!Yury Gribov2015-05-281-163/+76
| | | | | | Differential Revision: http://reviews.llvm.org/D7098 llvm-svn: 238402
* Final fix for PR 23499 and IR test case.Diego Novillo2015-05-271-5/+5
| | | | | | | | | | | This fixes a bit I forgot in r238335. In addition to the data record and the counter, we can also move the name of the counter to the comdat for the associated function. I'm also adding an IR test case to check that these three elements are placed in the proper comdat. llvm-svn: 238351
* Fix PR 23499 - Avoid multiple profile counters for functions in comdat sections.Diego Novillo2015-05-271-0/+6
| | | | | | | | Counter symbols created for linkonce functions are not discarded by ELF linkers unless the symbols are placed in the same comdat section as its associated function. llvm-svn: 238335
* Simplify IRBuilder::CreateCall* by using ArrayRef+initializer_list/braced ↵David Blaikie2015-05-188-125/+130
| | | | | | init only llvm-svn: 237624
* InstrProf: Update name of compiler-rt routine for setting filenameJustin Bogner2015-05-121-1/+1
| | | | | | Patch by Teresa Johnson. llvm-svn: 237186
* Convert PHI getIncomingValue() to foreach over incoming_values(). NFC.Pete Cooper2015-05-121-2/+1
| | | | | | | | We already had a method to iterate over all the incoming values of a PHI. This just changes all eligible code to use it. Ineligible code included anything which cared about the index, or was also trying to get the i'th incoming BB. llvm-svn: 237169
* SanitizerCoverage: Use `createSanitizerCtor` to create ctor and call initIsmail Pazarbasi2015-05-101-20/+13
| | | | | | | | | | | | | | Second attempt; instead of using a named local variable, passing arguments directly to `createSanitizerCtorAndInitFunctions` worked on Windows. Reviewers: kcc, samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8780 llvm-svn: 236951
* Delete unused createSanitizerCoverageModulePass overload.Alexey Samsonov2015-05-071-3/+0
| | | | llvm-svn: 236791
* Revert "SanitizerCoverage: Use `createSanitizerCtor` to create ctor and call ↵Ismail Pazarbasi2015-05-071-11/+16
| | | | | | | | init" Will fix tomorrow. Unbreak build bots now. llvm-svn: 236786
* SanitizerCoverage: Use `createSanitizerCtor` to create ctor and call initIsmail Pazarbasi2015-05-071-16/+11
| | | | | | | | | | Reviewers: kcc, samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8780 llvm-svn: 236780
* MSan: Use `createSanitizerCtor` to create ctor, and call `__msan_init`Ismail Pazarbasi2015-05-071-3/+12
| | | | | | | | | | Reviewers: kcc, eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8781 llvm-svn: 236779
* TSan: Use `createSanitizerCtor` to create ctor, and call `__tsan_init`Ismail Pazarbasi2015-05-071-6/+13
| | | | | | | | | | Reviewers: kcc, dvyukov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8779 llvm-svn: 236778
* ASan: Use `createSanitizerCtor` to create ctor, and call `__asan_init`Ismail Pazarbasi2015-05-071-10/+4
| | | | | | | | | | Reviewers: kcc, samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8778 llvm-svn: 236777
* [SanitizerCoverage] Introduce SanitizerCoverageOptions struct.Alexey Samsonov2015-05-071-30/+68
| | | | | | | | | | | | | | | | | | | Summary: This gives frontend more precise control over collected coverage information. User can still override these options by passing -mllvm flags. No functionality change. Test Plan: regression test suite. Reviewers: kcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9539 llvm-svn: 236687
* Change typeIncompatible to return an AttrBuilder instead of new-ing an ↵Pete Cooper2015-05-061-8/+7
| | | | | | | | | | AttributeSet. This makes use of the new API which can remove attributes from a set given a builder. This is much faster than creating a temporary set and reduces llc time by about 0.3% which was all spent creating temporary attributes sets on the context. llvm-svn: 236668
* [SanitizerCoverage] Fix a couple of typos. NFC.Alexey Samsonov2015-05-061-7/+7
| | | | llvm-svn: 236643
* InstrProf: Instrumenter support for setting profile output from command lineJustin Bogner2015-04-301-3/+23
| | | | | | | | | | | | | | | This change is the second of 3 patches to add support for specifying the profile output from the command line via -fprofile-instr-generate=<path>, where the specified output path/file will be overridden by the LLVM_PROFILE_FILE environment variable. This patch adds the necessary support to the llvm instrumenter, specifically a new member of GCOVOptions for clang to save the specified filename, and support for calling the new compiler-rt interface from __llvm_profile_init. Patch by Teresa Johnson. Thanks! llvm-svn: 236288
* IR: Give 'DI' prefix to debug info metadataDuncan P. N. Exon Smith2015-04-293-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Finish off PR23080 by renaming the debug info IR constructs from `MD*` to `DI*`. The last of the `DIDescriptor` classes were deleted in r235356, and the last of the related typedefs removed in r235413, so this has all baked for about a week. Note: If you have out-of-tree code (like a frontend), I recommend that you get everything compiling and tests passing with the *previous* commit before updating to this one. It'll be easier to keep track of what code is using the `DIDescriptor` hierarchy and what you've already updated, and I think you're extremely unlikely to insert bugs. YMMV of course. Back to *this* commit: I did this using the rename-md-di-nodes.sh upgrade script I've attached to PR23080 (both code and testcases) and filtered through clang-format-diff.py. I edited the tests for test/Assembler/invalid-generic-debug-node-*.ll by hand since the columns were off-by-three. It should work on your out-of-tree testcases (and code, if you've followed the advice in the previous paragraph). Some of the tests are in badly named files now (e.g., test/Assembler/invalid-mdcompositetype-missing-tag.ll should be 'dicompositetype'); I'll come back and move the files in a follow-up commit. llvm-svn: 236120
* DebugInfo: Delete subclasses of DIScopeDuncan P. N. Exon Smith2015-04-201-8/+9
| | | | | | | Delete subclasses of (the already defunct) `DIScope`, updating users to use the raw pointers from the `Metadata` hierarchy directly. llvm-svn: 235356
* DebugInfo: Remove DIDescriptor from the DebugInfo APIDuncan P. N. Exon Smith2015-04-171-1/+1
| | | | | | | Stop using `DIDescriptor` and its subclasses in the `DebugInfoFinder` API, as well as the rest of the API hanging around in `DebugInfo.h`. llvm-svn: 235240
* DebugInfo: Gut DICompileUnit and DIFileDuncan P. N. Exon Smith2015-04-151-1/+1
| | | | | | | Continuing gutting `DIDescriptor` subclasses; this edition, `DICompileUnit` and `DIFile`. In the name of PR23080. llvm-svn: 235055
* DebugInfo: Gut DISubprogram and DILexicalBlock*Duncan P. N. Exon Smith2015-04-142-17/+17
| | | | | | | Gut the `DIDescriptor` wrappers around `MDLocalScope` subclasses. Note that `DILexicalBlock` wraps `MDLexicalBlockBase`, not `MDLexicalBlock`. llvm-svn: 234850
* Mark empty default constructors as =default if it makes the type PODBenjamin Kramer2015-04-111-1/+1
| | | | | | NFC llvm-svn: 234694
* Reduce dyn_cast<> to isa<> or cast<> where possible.Benjamin Kramer2015-04-102-2/+2
| | | | | | No functional change intended. llvm-svn: 234586
* DebugInfo: Remove DITypedArray<>, replace with typedefsDuncan P. N. Exon Smith2015-04-071-11/+2
| | | | | | | | | | | | | | | | | Replace all uses of `DITypedArray<>` with `MDTupleTypedArrayWrapper<>` and `MDTypeRefArray`. The APIs are completely different, but the provided functionality is the same: treat an `MDTuple` as if it's an array of a particular element type. To simplify this patch a bit, I've temporarily typedef'ed `DebugNodeArray` to `DIArray` and `MDTypeRefArray` to `DITypeArray`. I've also temporarily conditionalized the accessors to check for null -- eventually these should be changed to asserts and the callers should check for null themselves. There's a tiny accompanying patch to clang. llvm-svn: 234290
* Transforms: Stop using DIDescriptor::is*() and auto-castingDuncan P. N. Exon Smith2015-04-061-10/+6
| | | | | | Same as r234255, but for lib/Analysis and lib/Transforms. llvm-svn: 234257
* Move `checkInterfaceFunction` to ModuleUtilsIsmail Pazarbasi2015-04-063-91/+66
| | | | | | | | | | | | | | Summary: Instead of making a local copy of `checkInterfaceFunction` for each sanitizer, move the function in a common place. Reviewers: kcc, samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8775 llvm-svn: 234220
* clang-format my last commitDavid Blaikie2015-04-051-1/+2
| | | | llvm-svn: 234127
* [opaque pointer type] The last of the GEP IRBuilder API migrationsDavid Blaikie2015-04-051-6/+5
| | | | | | | | | There's still lots of callers passing nullptr, of course - some because they'll never be migrated (InstCombines for bitcasts - well they don't make any sense when the pointer type is opaque anyway, for example) and others that will need more engineering to pass Types around. llvm-svn: 234126
* [opaque pointer type] More GEP API migrationsDavid Blaikie2015-04-041-3/+4
| | | | llvm-svn: 234108
* [opaque pointer type] More GEP IRBuilder API migrationsDavid Blaikie2015-04-032-6/+10
| | | | llvm-svn: 234064
* [opaque pointer type] More GEP IRBuilder API migrations...David Blaikie2015-04-031-1/+2
| | | | llvm-svn: 234058
OpenPOWER on IntegriCloud