summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm-c/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Reorganize the C API headers to improve build times.Eric Christopher2015-12-184-5/+4
| | | | | | | | | Type specific declarations have been moved to Type.h and error handling routines have been moved to ErrorHandling.h. Both are included in Core.h so nothing should change for projects directly including the headers, but transitive dependencies may be affected. llvm-svn: 255965
* [BDCE] Add a bit-tracking DCE passHal Finkel2015-02-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BDCE is a bit-tracking dead code elimination pass. It is based on ADCE (the "aggressive DCE" pass), with the added capability to track dead bits of integer valued instructions and remove those instructions when all of the bits are dead. Currently, it does not actually do this all-bits-dead removal, but rather replaces the instruction's uses with a constant zero, and lets instcombine (and the later run of ADCE) do the rest. Because we essentially get a run of ADCE "for free" while tracking the dead bits, we also do what ADCE does and removes actually-dead instructions as well (this includes instructions newly trivially dead because all bits were dead, but not all such instructions can be removed). The motivation for this is a case like: int __attribute__((const)) foo(int i); int bar(int x) { x |= (4 & foo(5)); x |= (8 & foo(3)); x |= (16 & foo(2)); x |= (32 & foo(1)); x |= (64 & foo(0)); x |= (128& foo(4)); return x >> 4; } As it turns out, if you order the bit-field insertions so that all of the dead ones come last, then instcombine will remove them. However, if you pick some other order (such as the one above), the fact that some of the calls to foo() are useless is not locally obvious, and we don't remove them (without this pass). I did a quick compile-time overhead check using sqlite from the test suite (Release+Asserts). BDCE took ~0.4% of the compilation time (making it about twice as expensive as ADCE). I've not looked at why yet, but we eliminate instructions due to having all-dead bits in: External/SPEC/CFP2006/447.dealII/447.dealII External/SPEC/CINT2006/400.perlbench/400.perlbench External/SPEC/CINT2006/403.gcc/403.gcc MultiSource/Applications/ClamAV/clamscan MultiSource/Benchmarks/7zip/7zip-benchmark llvm-svn: 229462
* [C API] Make the 'lower switch' pass available via the C API.Juergen Ributzka2014-09-111-0/+3
| | | | llvm-svn: 217630
* Add an AlignmentFromAssumptions PassHal Finkel2014-09-071-0/+3
| | | | | | | | | | | | | | | | | | | | | This adds a ScalarEvolution-powered transformation that updates load, store and memory intrinsic pointer alignments based on invariant((a+q) & b == 0) expressions. Many of the simple cases we can get with ValueTracking, but we still need something like this for the more complicated cases (such as those with an offset) that require some algebra. Note that gcc's __builtin_assume_aligned's optional third argument provides exactly for this kind of 'misalignment' offset for which this kind of logic is necessary. The primary motivation is to fixup alignments for vector loads/stores after vectorization (and unrolling). This pass is added to the optimization pipeline just after the SLP vectorizer runs (which, admittedly, does not preserve SE, although I imagine it could). Regardless, I actually don't think that the preservation matters too much in this case: SE computes lazily, and this pass won't issue any SE queries unless there are any assume intrinsics, so there should be no real additional cost in the common case (SLP does preserve DT and LoopInfo). llvm-svn: 217344
* Add scoped-noalias metadataHal Finkel2014-07-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds scoped noalias metadata. The primary motivations for this feature are: 1. To preserve noalias function attribute information when inlining 2. To provide the ability to model block-scope C99 restrict pointers Neither of these two abilities are added here, only the necessary infrastructure. In fact, there should be no change to existing functionality, only the addition of new features. The logic that converts noalias function parameters into this metadata during inlining will come in a follow-up commit. What is added here is the ability to generally specify noalias memory-access sets. Regarding the metadata, alias-analysis scopes are defined similar to TBAA nodes: !scope0 = metadata !{ metadata !"scope of foo()" } !scope1 = metadata !{ metadata !"scope 1", metadata !scope0 } !scope2 = metadata !{ metadata !"scope 2", metadata !scope0 } !scope3 = metadata !{ metadata !"scope 2.1", metadata !scope2 } !scope4 = metadata !{ metadata !"scope 2.2", metadata !scope2 } Loads and stores can be tagged with an alias-analysis scope, and also, with a noalias tag for a specific scope: ... = load %ptr1, !alias.scope !{ !scope1 } ... = load %ptr2, !alias.scope !{ !scope1, !scope2 }, !noalias !{ !scope1 } When evaluating an aliasing query, if one of the instructions is associated with an alias.scope id that is identical to the noalias scope associated with the other instruction, or is a descendant (in the scope hierarchy) of the noalias scope associated with the other instruction, then the two memory accesses are assumed not to alias. Note that is the first element of the scope metadata is a string, then it can be combined accross functions and translation units. The string can be replaced by a self-reference to create globally unqiue scope identifiers. [Note: This overview is slightly stylized, since the metadata nodes really need to just be numbers (!0 instead of !scope0), and the scope lists are also global unnamed metadata.] Existing noalias metadata in a callee is "cloned" for use by the inlined code. This is necessary because the aliasing scopes are unique to each call site (because of possible control dependencies on the aliasing properties). For example, consider a function: foo(noalias a, noalias b) { *a = *b; } that gets inlined into bar() { ... if (...) foo(a1, b1); ... if (...) foo(a2, b2); } -- now just because we know that a1 does not alias with b1 at the first call site, and a2 does not alias with b2 at the second call site, we cannot let inlining these functons have the metadata imply that a1 does not alias with b2. llvm-svn: 213864
* MergedLoadStoreMotion passGerolf Hoflehner2014-07-181-0/+3
| | | | | | | | | | | Merges equivalent loads on both sides of a hammock/diamond and hoists into into the header. Merges equivalent stores on both sides of a hammock/diamond and sinks it to the footer. Can enable if conversion and tolerate better load misses and store operand latencies. llvm-svn: 213396
* The LLVM C API shouldn't be including a file from the C++ API. Especially not aRichard Smith2014-04-081-1/+0
| | | | | | file that it doesn't use. llvm-svn: 205755
* Add a Scalarizer pass.Richard Sandiford2013-11-221-0/+3
| | | | llvm-svn: 195471
* Add a loop rerolling passHal Finkel2013-11-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a loop rerolling pass: the opposite of (partial) loop unrolling. The transformation aims to take loops like this: for (int i = 0; i < 3200; i += 5) { a[i] += alpha * b[i]; a[i + 1] += alpha * b[i + 1]; a[i + 2] += alpha * b[i + 2]; a[i + 3] += alpha * b[i + 3]; a[i + 4] += alpha * b[i + 4]; } and turn them into this: for (int i = 0; i < 3200; ++i) { a[i] += alpha * b[i]; } and loops like this: for (int i = 0; i < 500; ++i) { x[3*i] = foo(0); x[3*i+1] = foo(0); x[3*i+2] = foo(0); } and turn them into this: for (int i = 0; i < 1500; ++i) { x[i] = foo(0); } There are two motivations for this transformation: 1. Code-size reduction (especially relevant, obviously, when compiling for code size). 2. Providing greater choice to the loop vectorizer (and generic unroller) to choose the unrolling factor (and a better ability to vectorize). The loop vectorizer can take vector lengths and register pressure into account when choosing an unrolling factor, for example, and a pre-unrolled loop limits that choice. This is especially problematic if the manual unrolling was optimized for a machine different from the current target. The current implementation is limited to single basic-block loops only. The rerolling recognition should work regardless of how the loop iterations are intermixed within the loop body (subject to dependency and side-effect constraints), but the significant restriction is that the order of the instructions in each iteration must be identical. This seems sufficient to capture all current use cases. This pass is not currently enabled by default at any optimization level. llvm-svn: 194939
* Turn MipsOptimizeMathLibCalls into a target-independent scalar transformRichard Sandiford2013-08-231-0/+3
| | | | | | | | | | ...so that it can be used for z too. Most of the code is the same. The only real change is to use TargetTransformInfo to test when a sqrt instruction is available. The pass is opt-in because at the moment it only handles sqrt. llvm-svn: 189097
* Move C++ code out of the C headers and into either C++ headersEric Christopher2013-04-221-10/+0
| | | | | | | or the C++ files themselves. This enables people to use just a C compiler to interoperate with LLVM. llvm-svn: 180063
* Rename the C function to create a SLPVectorizerPass to something sane and ↵Benjamin Kramer2013-04-111-0/+3
| | | | | | expose it in the header file. llvm-svn: 179272
* Revert r178713Evan Cheng2013-04-041-7/+2
| | | | llvm-svn: 178769
* Make it possible to include llvm-c without including C++ headers. Patch by ↵Evan Cheng2013-04-031-2/+7
| | | | | | Filip Pizlo. llvm-svn: 178713
* Use LLVMBool instead of 'bool' in the C API. Based on a patch by Peter Zotov!Nick Lewycky2013-03-101-2/+2
| | | | llvm-svn: 176793
* Fix include guards so they exactly match file names.Jakub Staszak2013-01-101-2/+2
| | | | llvm-svn: 172025
* Symbol hygiene: Make sure declarations and definitions match, make helper ↵Benjamin Kramer2012-10-201-0/+3
| | | | | | functions static. llvm-svn: 166376
* Organize LLVM C API docs into doxygen modules; add docsGregory Szorc2012-03-214-0/+43
| | | | | | | | | | | | | | | | This gives a lot of love to the docs for the C API. Like Clang's documentation, the C API is now organized into a Doxygen "module" (LLVMC). Each C header file is a child of the main module. Some modules (like Core) have a hierarchy of there own. The produced documentation is thus better organized (before everything was in one monolithic list). This patch also includes a lot of new documentation for APIs in Core.h. It doesn't document them all, but is better than none. Function docs are missing @param and @return annotation, but the documentation body now commonly provides help details (like the expected llvm::Value sub-type to expect). llvm-svn: 153157
* A few of the changes suggested in code review (by Nick Lewycky)Hal Finkel2012-02-011-1/+1
| | | | llvm-svn: 149472
* Add a basic-block autovectorization pass.Hal Finkel2012-02-011-0/+37
| | | | | | | This is the initial checkin of the basic-block autovectorization pass along with some supporting vectorization infrastructure. Special thanks to everyone who helped review this code over the last several months (especially Tobias Grosser). llvm-svn: 149468
* Add missing file.Rafael Espindola2011-08-091-0/+90
| | | | llvm-svn: 137162
* Remove the LowerSetJmp pass. It wasn't used effectively by any of the targets.Bill Wendling2011-08-031-3/+0
| | | | | | This is some of my original LLVM code. *wipes tear* llvm-svn: 136821
* Add LLVMAddAlwaysInlinerPass to the C API.Rafael Espindola2011-07-261-0/+3
| | | | llvm-svn: 136083
* LLVM 3.0 is here, remove old do nothing method.Rafael Espindola2011-07-261-3/+0
| | | | llvm-svn: 136082
* Add LLVMAddLowerExpectIntrinsicPass to the C API.Rafael Espindola2011-07-251-0/+3
| | | | llvm-svn: 135966
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-091-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. llvm-svn: 134829
* Add the alias analysis to the C api.Rafael Espindola2011-04-131-0/+7
| | | | llvm-svn: 129447
* Expose more passes to the C API.Rafael Espindola2011-04-071-0/+12
| | | | llvm-svn: 129087
* remove dead prototype, PR8351Chris Lattner2010-10-111-3/+0
| | | | llvm-svn: 116209
* Adding IPSCCP and Internalize passes to the C-bindingsWesley Peck2010-04-091-0/+6
| | | | llvm-svn: 100893
* Whoops this already existed.Nate Begeman2010-03-111-3/+0
| | | | llvm-svn: 98297
* Add a handful of additional useful pass manager things to the C APINate Begeman2010-03-111-0/+10
| | | | llvm-svn: 98296
* remove the now dead condprop pass, PR3906.Chris Lattner2009-11-111-3/+0
| | | | llvm-svn: 86810
* Auto-upgrade free instructions to calls to the builtin free function.Victor Hernandez2009-10-241-1/+1
| | | | | | | Update all analysis passes and transforms to treat free calls just like FreeInst. Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised. llvm-svn: 84987
* fix header comment and include guard.Chris Lattner2009-03-061-9/+5
| | | | llvm-svn: 66273
* add a bunch more passes to the C bindings (PR3734), patch byChris Lattner2009-03-062-9/+131
| | | | | | Lennart Augustsson! llvm-svn: 66272
* C and Objective Caml bindings for mem2reg and reg2mem.Gordon Henriksen2008-03-201-0/+6
| | | | | | Patch by Erick Tryzelaar. llvm-svn: 48602
* C and Objective Caml bindings for several scalar transforms.Gordon Henriksen2008-03-161-0/+47
Patch originally by Erick Tryzelaar, but has been modified somewhat. llvm-svn: 48419
OpenPOWER on IntegriCloud