summaryrefslogtreecommitdiff
path: root/include/llvm/Transforms
Commit message (Collapse)AuthorAge
* Extend RemapInstruction and friends to take an optional new parameter, a ↵James Molloy2013-05-28
| | | | | | | | ValueMaterializer. Extend LinkModules to pass a ValueMaterializer to RemapInstruction and friends to lazily create Functions for lazily linked globals. This is a big win when linking small modules with large (mostly unused) library modules. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182776 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-implement DebugIR in a way that does not subclass AssemblyWriter:Daniel Malea2013-05-23
| | | | | | | | | | | | | - move AsmWriter.h from public headers into lib - marked all AssemblyWriter functions as non-virtual; no need to override them - DebugIR now "plugs into" AssemblyWriter with an AssemblyAnnotationWriter helper - exposed flags to control hiding of a) debug metadata b) debug intrinsic calls C/R: Paul Redmond git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182617 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename LoopSimplify.h to LoopUtils.hHal Finkel2013-05-20
| | | | | | As discussed, LoopUtils.h is a better name. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182314 91177308-0d34-0410-b5e6-96231b3b80d8
* Expose InsertPreheaderForLoop from LoopSimplify to other passesHal Finkel2013-05-20
| | | | | | | | | | | Other passes, PPC counter-loop formation for example, also need to add loop preheaders outside of the regular loop simplification pass. This makes InsertPreheaderForLoop a global function so that it can be used by other passes. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182299 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
* fix a typo that due to cu&paste quadrupled itselfAdrian Prantl2013-04-26
| | | | | | rdar://problem/13056109 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180618 91177308-0d34-0410-b5e6-96231b3b80d8
* Bugfix for the debug intrinsic handling in InstCombiner:Adrian Prantl2013-04-26
| | | | | | | | | | | Since we can't guarantee that the original dbg.declare instrinsic is removed by LowerDbgDeclare(), we need to make sure that we are not inserting the same dbg.value intrinsic over and over. This removes tons of redundant DIEs when compiling optimized code. rdar://problem/13056109 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180615 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an option -vectorize-slp-aggressive for running the BB vectorizer. Make ↵Nadav Rotem2013-04-15
| | | | | | -fslp-vectorize run the slp-vectorizer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179508 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename the slp-vectorizer clang/llvm flags. No functionality change.Nadav Rotem2013-04-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179505 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
* Add support for bottom-up SLP vectorization infrastructure.Nadav Rotem2013-04-09
| | | | | | | | | | | | | | | | | | | | | | | | This commit adds the infrastructure for performing bottom-up SLP vectorization (and other optimizations) on parallel computations. The infrastructure has three potential users: 1. The loop vectorizer needs to be able to vectorize AOS data structures such as (sum += A[i] + A[i+1]). 2. The BB-vectorizer needs this infrastructure for bottom-up SLP vectorization, because bottom-up vectorization is faster to compute. 3. A loop-roller needs to be able to analyze consecutive chains and roll them into a loop, in order to reduce code size. A loop roller does not need to create vector instructions, and this infrastructure separates the chain analysis from the vectorization. This patch also includes a simple (100 LOC) bottom up SLP vectorizer that uses the infrastructure, and can vectorize this code: void SAXPY(int *x, int *y, int a, int i) { x[i] = a * x[i] + y[i]; x[i+1] = a * x[i+1] + y[i+1]; x[i+2] = a * x[i+2] + y[i+2]; x[i+3] = a * x[i+3] + y[i+3]; } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179117 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
* 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
* Fix typo in comment.Nick Lewycky2013-03-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176997 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
* 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
* Enhance integer division emulation support to handle types smaller than 32 bits,Pedro Artigas2013-02-26
| | | | | | | | | enhancement done the trivial way; by extending inputs and truncating outputs which is addequate for targets with little or no support for integer arithmetic on integer types less than 32 bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176139 91177308-0d34-0410-b5e6-96231b3b80d8
* BBVectorize: Cap the number of candidate pairs in each instruction groupHal Finkel2013-02-15
| | | | | | | | | | | | | | | | | | | | | | | For some basic blocks, it is possible to generate many candidate pairs for relatively few pairable instructions. When many (tens of thousands) of these pairs are generated for a single instruction group, the time taken to generate and rank the different vectorization plans can become quite large. As a result, we now cap the number of candidate pairs within each instruction group. This is done by closing out the group once the threshold is reached (set now at 3000 pairs). Although this will limit the overall compile-time impact, this may not be the best way to achieve this result. It might be better, for example, to prune excessive candidate pairs after the fact the prevent the generation of short, but highly-connected groups. We can experiment with this in the future. This change reduces the overall compile-time slowdown of the csa.ll test case in PR15222 to ~5x. If 5x is still considered too large, a lower limit can be used as the default. This represents a functionality change, but only for very large inputs (thus, there is no regression test). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175251 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unneeded #includes.Jakub Staszak2013-02-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174806 91177308-0d34-0410-b5e6-96231b3b80d8
* Extracted ObjCARC.cpp into its own library libLLVMObjCARCOpts in preparation ↵Michael Gottesman2013-01-28
| | | | | | for refactoring the ARC Optimizer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173647 91177308-0d34-0410-b5e6-96231b3b80d8
* Move Blacklist.h to include/ to enable use from clang.Will Dietz2013-01-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172806 91177308-0d34-0410-b5e6-96231b3b80d8
* ASan: add optional 'zero-based shadow' option to ASan passes. Always tell ↵Alexey Samsonov2013-01-17
| | | | | | the values of shadow scale and offset to the runtime git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172709 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix include guards so they exactly match file names.Jakub Staszak2013-01-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172025 91177308-0d34-0410-b5e6-96231b3b80d8
* Move CallGraphSCCPass.h into the Analysis tree; that's where theChandler Carruth2013-01-07
| | | | | | implementation lives already. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171746 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch the SCEV expander and LoopStrengthReduce to useChandler Carruth2013-01-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TargetTransformInfo rather than TargetLowering, removing one of the primary instances of the layering violation of Transforms depending directly on Target. This is a really big deal because LSR used to be a "special" pass that could only be tested fully using llc and by looking at the full output of it. It also couldn't run with any other loop passes because it had to be created by the backend. No longer is this true. LSR is now just a normal pass and we should probably lift the creation of LSR out of lib/CodeGen/Passes.cpp and into the PassManagerBuilder. =] I've not done this, or updated all of the tests to use opt and a triple, because I suspect someone more familiar with LSR would do a better job. This change should be essentially without functional impact for normal compilations, and only change behvaior of targetless compilations. The conversion required changing all of the LSR code to refer to the TTI interfaces, which fortunately are very similar to TargetLowering's interfaces. However, it also allowed us to *always* expect to have some implementation around. I've pushed that simplification through the pass, and leveraged it to simplify code somewhat. It required some test updates for one of two things: either we used to skip some checks altogether but now we get the default "no" answer for them, or we used to have no information about the target and now we do have some. I've also started the process of removing AddrMode, as the TTI interface doesn't use it any longer. In some cases this simplifies code, and in others it adds some complexity, but I think it's not a bad tradeoff even there. Subsequent patches will try to clean this up even further and use other (more appropriate) abstractions. Yet again, almost all of the formatting changes brought to you by clang-format. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171735 91177308-0d34-0410-b5e6-96231b3b80d8
* Make SimplifyCFG simply depend upon TargetTransformInfo and pass itChandler Carruth2013-01-07
| | | | | | | | | | | | | through as a reference rather than a pointer. There is always *some* implementation of this available, so this simplifies code by not having to test for whether it is available or not. Further, it turns out there were piles of places where SimplifyCFG was recursing and not passing down either TD or TTI. These are fixed to be more pedantically consistent even though I don't have any particular cases where it would matter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171691 91177308-0d34-0410-b5e6-96231b3b80d8
* Sink the AddressingModeMatcher helper class into an anonymous namespaceChandler Carruth2013-01-05
| | | | | | | | | | | | next to its only user. This helper relies on TargetLowering information that shouldn't be generally used throughout the Transfoms library, and so it made little sense as a generic utility. This also consolidates the file where we need to remove the remaining uses of TargetLowering in favor of the IR-layer abstract interface in TargetTransformInfo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171590 91177308-0d34-0410-b5e6-96231b3b80d8
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-02
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
* Add proper support for -fsanitize-blacklist= flag for TSan and MSan. LLVM part.Alexey Samsonov2012-12-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171183 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Remove unreachable blocks before instrumenting a function.Evgeniy Stepanov2012-12-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170883 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Add track-origins argument to the pass constructor.Evgeniy Stepanov2012-12-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170544 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorizer: Use the "optsize" attribute to decide if we are allowed to ↵Nadav Rotem2012-12-12
| | | | | | increase the function size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170004 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve debug info generated with enabled AddressSanitizer.Alexey Samsonov2012-12-12
| | | | | | | | | | | | | When ASan replaces <alloca instruction> with <offset into a common large alloca>, it should also patch llvm.dbg.declare calls and replace debug info descriptors to mark that we've replaced alloca with a value that stores an address of the user variable, not the user variable itself. See PR11818 for more context. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169984 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopVectorizer: When -Os is used, vectorize only loops that dont require a ↵Nadav Rotem2012-12-12
| | | | | | tail loop. There is no testcase because I dont know of a way to initialize the loop vectorizer pass without adding an additional hidden flag. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169950 91177308-0d34-0410-b5e6-96231b3b80d8
* Use an ArrayRef instead of a std::vector&.Rafael Espindola2012-12-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169881 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use a red zone for code coverage if the user specified `-mno-red-zone'.Bill Wendling2012-12-10
| | | | | | | | | | The `-mno-red-zone' flag wasn't being propagated to the functions that code coverage generates. This allowed some of them to use the red zone when that wasn't allowed. <rdar://problem/12843084> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169754 91177308-0d34-0410-b5e6-96231b3b80d8
* s/AttrListPtr/AttributeSet/g to better label what this class is going to be ↵Bill Wendling2012-12-07
| | | | | | in the near future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169651 91177308-0d34-0410-b5e6-96231b3b80d8
* Add 'using' declarations to suppress -Woverloaded-virtual warnings.Matt Beaumont-Gay2012-12-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169214 91177308-0d34-0410-b5e6-96231b3b80d8
* minor renaming, documentation and cleanups.Nadav Rotem2012-12-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169175 91177308-0d34-0410-b5e6-96231b3b80d8
* ASan: add blacklist file to ASan pass options. Clang patch for this will follow.Alexey Samsonov2012-12-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169143 91177308-0d34-0410-b5e6-96231b3b80d8
* Sort the #include lines for the include/... tree with the script.Chandler Carruth2012-12-03
| | | | | | | | | | AKA: Recompile *ALL* the source code! This one went much better. No manual edits here. I spot-checked for silliness and grep-checked for really broken edits and everything seemed good. It all still compiles. Yell if you see something that looks goofy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169133 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* Add options to AddressSanitizer passes to make them configurable by frontend.Alexey Samsonov2012-11-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168910 91177308-0d34-0410-b5e6-96231b3b80d8
* Initial commit of MemorySanitizer.Evgeniy Stepanov2012-11-29
| | | | | | | Compiler pass only. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168866 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Split AddressSanitizer into two passes (FunctionPass, ModulePass), ↵Kostya Serebryany2012-11-28
| | | | | | LLVM part. This requires a clang part which will follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168781 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused parameter Penalty from the BoundsChecking pass.Joey Gouly2012-11-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168511 91177308-0d34-0410-b5e6-96231b3b80d8
* instcombine: Migrate math library call simplificationsMeador Inge2012-11-13
| | | | | | | | | | | | | | | | | This patch migrates the math library call simplifications from the simplify-libcalls pass into the instcombine library call simplifier. I have typically migrated just one simplifier at a time, but the math simplifiers are interdependent because: 1. CosOpt, PowOpt, and Exp2Opt all depend on UnaryDoubleFPOpt. 2. CosOpt, PowOpt, Exp2Opt, and UnaryDoubleFPOpt all depend on the option -enable-double-float-shrink. These two factors made migrating each of these simplifiers individually more of a pain than it would be worth. So, I migrated them all together. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167815 91177308-0d34-0410-b5e6-96231b3b80d8
* Add method for replacing instructions to LibCallSimplifierMeador Inge2012-11-11
| | | | | | | | | | | | | | | In some cases the library call simplifier may need to replace instructions other than the library call being simplified. In those cases it may be necessary for clients of the simplifier to override how the replacements are actually done. As such, a new overrideable method for replacing instructions was added to LibCallSimplifier. A new subclass of LibCallSimplifier is also defined which overrides the instruction replacement method. This is because the instruction combiner defines its own replacement method which updates the worklist when instructions are replaced. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167681 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert the majority of the next patch in the address space series:Chandler Carruth2012-11-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r165941: Resubmit the changes to llvm core to update the functions to support different pointer sizes on a per address space basis. Despite this commit log, this change primarily changed stuff outside of VMCore, and those changes do not carry any tests for correctness (or even plausibility), and we have consistently found questionable or flat out incorrect cases in these changes. Most of them are probably correct, but we need to devise a system that makes it more clear when we have handled the address space concerns correctly, and ideally each pass that gets updated would receive an accompanying test case that exercises that pass specificaly w.r.t. alternate address spaces. However, from this commit, I have retained the new C API entry points. Those were an orthogonal change that probably should have been split apart, but they seem entirely good. In several places the changes were very obvious cleanups with no actual multiple address space code added; these I have not reverted when I spotted them. In a few other places there were merge conflicts due to a cleaner solution being implemented later, often not using address spaces at all. In those cases, I've preserved the new code which isn't address space dependent. This is part of my ongoing effort to clean out the partial address space code which carries high risk and low test coverage, and not likely to be finished before the 3.2 release looms closer. Duncan and I would both like to see the above issues addressed before we return to these changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167222 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert the series of commits starting with r166578 which introduced theChandler Carruth2012-11-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | getIntPtrType support for multiple address spaces via a pointer type, and also introduced a crasher bug in the constant folder reported in PR14233. These commits also contained several problems that should really be addressed before they are re-committed. I have avoided reverting various cleanups to the DataLayout APIs that are reasonable to have moving forward in order to reduce the amount of churn, and minimize the number of commits that were reverted. I've also manually updated merge conflicts and manually arranged for the getIntPtrType function to stay in DataLayout and to be defined in a plausible way after this revert. Thanks to Duncan for working through this exact strategy with me, and Nick Lewycky for tracking down the really annoying crasher this triggered. (Test case to follow in its own commit.) After discussing with Duncan extensively, and based on a note from Micah, I'm going to continue to back out some more of the more problematic patches in this series in order to ensure we go into the LLVM 3.2 branch with a reasonable story here. I'll send a note to llvmdev explaining what's going on and why. Summary of reverted revisions: r166634: Fix a compiler warning with an unused variable. r166607: Add some cleanup to the DataLayout changes requested by Chandler. r166596: Revert "Back out r166591, not sure why this made it through since I cancelled the command. Bleh, sorry about this! r166591: Delete a directory that wasn't supposed to be checked in yet. r166578: Add in support for getIntPtrType to get the pointer type based on the address space. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167221 91177308-0d34-0410-b5e6-96231b3b80d8