summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombine.h
Commit message (Collapse)AuthorAgeFilesLines
* Move TargetData to DataLayout.Micah Villmow2012-10-081-4/+4
| | | | llvm-svn: 165402
* instcombine: merge the functions that remove dead allocas and dead ↵Nuno Lopes2012-07-091-1/+1
| | | | | | | | | mallocs/callocs/... This patch removes ~70 lines in InstCombineLoadStoreAlloca.cpp and makes both functions a bit more aggressive than before :) In theory, we can be more aggressive when removing an alloca than a malloc, because an alloca pointer should never escape, but we are not taking advantage of this anyway llvm-svn: 159952
* Move llvm/Support/IRBuilder.h -> llvm/IRBuilder.hChandler Carruth2012-06-291-1/+1
| | | | | | | | | | | | | | | | | This was always part of the VMCore library out of necessity -- it deals entirely in the IR. The .cpp file in fact was already part of the VMCore library. This is just a mechanical move. I've tried to go through and re-apply the coding standard's preferred header sort, but at 40-ish files, I may have gotten some wrong. Please let me know if so. I'll be committing the corresponding updates to Clang and Polly, and Duncan has DragonEgg. Thanks to Bill and Eric for giving the green light for this bit of cleanup. llvm-svn: 159421
* add a new pass to instrument loads and stores for run-time bounds checkingNuno Lopes2012-05-221-1/+1
| | | | | | | | move EmitGEPOffset from InstCombine to Transforms/Utils/Local.h (a draft of this) patch reviewed by Andrew, thanks. llvm-svn: 157261
* objectsize: add support for GEPs with non-constant indexesNuno Lopes2012-05-101-1/+1
| | | | | | add an additional parameter to InstCombiner::EmitGEPOffset() to force it to *not* emit operations with NUW flag llvm-svn: 156585
* Always compute all the bits in ComputeMaskedBits.Rafael Espindola2012-04-041-2/+2
| | | | | | | | This allows us to keep passing reduced masks to SimplifyDemandedBits, but know about all the bits if SimplifyDemandedBits fails. This allows instcombine to simplify cases like the one in the included testcase. llvm-svn: 154011
* Fix a few more places where TargetData/TargetLibraryInfo is not being passed.Chad Rosier2011-12-021-0/+2
| | | | | | Add FIXMEs to places that are non-trivial to fix. llvm-svn: 145661
* Last bit of TargetLibraryInfo propagation. Also fixed a case for TargetDataChad Rosier2011-12-011-1/+3
| | | | | | | where it appeared beneficial to pass. More of rdar://10500969 llvm-svn: 145630
* Inlining often produces landingpad instructions with repeatedDuncan Sands2011-09-301-0/+1
| | | | | | | | | | | | | | catch or repeated filter clauses. Teach instcombine a bunch of tricks for simplifying landingpad clauses. Currently the code only recognizes the GNU C++ and Ada personality functions, but that doesn't stop it doing a bunch of "generic" transforms which are hopefully fine for any real-world personality function. If these "generic" transforms turn out not to be generic, they can always be conditioned on the personality function. Probably someone should add the ObjC++ personality function. I didn't as I don't know anything about it. llvm-svn: 140852
* Split the init.trampoline intrinsic, which currently combines GCC'sDuncan Sands2011-09-061-1/+3
| | | | | | | | | | | | | | | | | | | | init.trampoline and adjust.trampoline intrinsics, into two intrinsics like in GCC. While having one combined intrinsic is tempting, it is not natural because typically the trampoline initialization needs to be done in one function, and the result of adjust trampoline is needed in a different (nested) function. To get around this llvm-gcc hacks the nested function lowering code to insert an additional parent variable holding the adjust.trampoline result that can be accessed from the child function. Dragonegg doesn't have the luxury of tweaking GCC code, so it stored the result of adjust.trampoline in the memory GCC set aside for the trampoline itself (this is always available in the child function), and set up some new memory (using an alloca) to hold the trampoline. Unfortunately this breaks Go which allocates trampoline memory on the heap and wants to use it even after the parent has exited (!). Rather than doing even more hacks to get Go working, it seemed best to just use two intrinsics like in GCC. Patch mostly by Sanjoy Das. llvm-svn: 139140
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-5/+5
| | | | llvm-svn: 135375
* Make the demanded bits/elements optimizations preserve debug line information.Eli Friedman2011-05-191-1/+9
| | | | | | I'm not sure this is quite ideal, but I can't really think of any better way to do it. llvm-svn: 131616
* Stop trying to have instcombine preserve LCSSA form: this was notDuncan Sands2011-04-271-1/+0
| | | | | | | | | | effective in avoiding recomputation of LCSSA form; the widespread use of instsimplify (which looks through phi nodes) means it was not preserving LCSSA form anyway; and instcombine is no longer scheduled in the middle of the loop passes so this doesn't matter anymore. llvm-svn: 130301
* Don't include Operator.h from InstrTypes.h.Jay Foad2011-04-111-0/+1
| | | | llvm-svn: 129271
* InstCombine: Move (sext icmp) transforms into their own method. No intended ↵Benjamin Kramer2011-04-011-0/+1
| | | | | | functionality change. llvm-svn: 128731
* Add some debug output when -instcombine uses RAUW. This can make debug ↵Frits van Bommel2011-03-271-1/+4
| | | | | | output for those cases much clearer since without this it only showed that the original instruction was removed, not what it was replaced with. llvm-svn: 128399
* llvm.dbg.declare intrinsic does not use any llvm::Values. It's magic!Devang Patel2011-03-081-1/+0
| | | | llvm-svn: 127282
* refactor some code out into a helper method.Chris Lattner2011-02-131-0/+2
| | | | llvm-svn: 125451
* Call SimplifyFDivInst() in InstCombiner::visitFDiv().Frits van Bommel2011-01-291-0/+1
| | | | llvm-svn: 124535
* Move InstCombine's knowledge of fdiv to SimplifyInstruction().Frits van Bommel2011-01-291-1/+0
| | | | llvm-svn: 124534
* remove the AllowAggressive argument to FoldOpIntoPhi. It is forced to false ↵Chris Lattner2011-01-161-4/+1
| | | | | | | | in the first line of the function because it isn't a good idea, even for compares. llvm-svn: 123566
* Move getOrEnforceKnownAlignment out of instcombine into Transforms/Utils.Chris Lattner2010-12-251-4/+0
| | | | llvm-svn: 122554
* Add a generic expansion transform: A op (B op' C) -> (A op B) op' (A op C)Duncan Sands2010-12-221-5/+6
| | | | | | | | if both A op B and A op C simplify. This fires fairly often but doesn't make that much difference. On gcc-as-one-file it removes two "and"s and turns one branch into a select. llvm-svn: 122399
* Rename SimplifyDistributed to the more meaningfull name SimplifyByFactorizing.Duncan Sands2010-11-231-5/+5
| | | | llvm-svn: 120051
* Exploit distributive laws (eg: And distributes over Or, Mul over Add, etc) in aDuncan Sands2010-11-231-0/+6
| | | | | | | | | | | | fairly systematic way in instcombine. Some of these cases were already dealt with, in which case I removed the existing code. The case of Add has a bunch of funky logic which covers some of this plus a few variants (considers shifts to be a form of multiplication), which I didn't touch. The simplification performed is: A*B+A*C -> A*(B+C). The improvement is to do this in cases that were not already handled [such as A*B-A*C -> A*(B-C), which was reported on the mailing list], and also to do it more often by not checking for "only one use" if "B+C" simplifies. llvm-svn: 120024
* Generalize the reassociation transform in SimplifyCommutative (now renamed toDuncan Sands2010-11-131-3/+3
| | | | | | | | | | | | | | | | SimplifyAssociativeOrCommutative) "(A op C1) op C2" -> "A op (C1 op C2)", which previously was only done if C1 and C2 were constants, to occur whenever "C1 op C2" simplifies (a la InstructionSimplify). Since the simplifying operand combination can no longer be assumed to be the right-hand terms, consider all of the possible permutations. When compiling "gcc as one big file", transform 2 (i.e. using right-hand operands) fires about 4000 times but it has to be said that most of the time the simplifying operands are both constants. Transforms 3, 4 and 5 each fired once. Transform 6, which is an existing transform that I didn't change, never fired. With this change, the testcase is now optimized perfectly with one run of instcombine (previously it required instcombine + reassociate + instcombine, and it may just have been luck that this worked). llvm-svn: 119002
* Get rid of static constructors for pass registration. Instead, every pass ↵Owen Anderson2010-10-191-1/+3
| | | | | | | | | | | | | | | | | exposes an initializeMyPassFunction(), which must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize the pass's dependencies. Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h before parsing commandline arguments. I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass registration/creation, please send the testcase to me directly. llvm-svn: 116820
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110460
* Revert r110396 to fix buildbots.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110410
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-051-1/+1
| | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
* use ArgOperand API, also tighten the type of visitFree to make this work out ↵Gabor Greif2010-06-241-1/+1
| | | | | | smoothly llvm-svn: 106736
* Teach instCombine to remove malloc+free if malloc's only uses are comparisonsDuncan Sands2010-05-271-0/+1
| | | | | | to null. Patch by Matti Niemenmaa. llvm-svn: 104871
* I got tired of VISIBILITY_HIDDEN colliding with the gcc enum. Rename itDuncan Sands2010-05-111-2/+2
| | | | | | | to LLVM_LIBRARY_VISIBILITY and introduce LLVM_GLOBAL_VISIBILITY, which is the opposite, for future use by dragonegg. llvm-svn: 103495
* Migrate _chk call lowering from SimplifyLibCalls to InstCombine. StubEric Christopher2010-03-061-0/+1
| | | | | | | | out the remainder of the calls that we should lower in some way and move the tests to the new correct directory. Fix up tests that are now optimized more than they were before by -instcombine. llvm-svn: 97875
* Fix PR6503. This turned into a much more interesting and nasty bug. Various Chris Lattner2010-03-051-6/+6
| | | | | | | | | | | parts of the cmp|cmp and cmp&cmp folding logic wasn't prepared for vectors (unrelated to the bug but noticed while in the code) and the code was *definitely* not safe to use by the (cast icmp)|(cast icmp) handling logic that I added in r95855. Fix all this up by changing the various routines to more consistently use IRBuilder and not pass in the I which had the wrong type. llvm-svn: 97801
* Rename ValueRequiresCast to ShouldOptimizeCast, to better reflectChris Lattner2010-02-111-5/+6
| | | | | | | | | | | | | | what it does. Enhance it to return false to optimizing vector sign extensions from vector comparisions, which is the idiom used to get a splatted vector for a vector comparison. Doing this breaks vector-casts.ll, add some compensating transformations to handle the important case they cover without depending on this canonicalization. This fixes rdar://7434900 a serious pessimization of vector compares. llvm-svn: 95855
* inline and remove the rest of commonIntCastTransforms.Chris Lattner2010-01-101-1/+0
| | | | llvm-svn: 93091
* make this a static function instead of a method.Chris Lattner2010-01-051-2/+0
| | | | llvm-svn: 92795
* split mul/div/rem instructions out to their own file.Chris Lattner2010-01-051-0/+1
| | | | llvm-svn: 92689
* convert various IntrinsicInst's to use class instead of struct.Chris Lattner2010-01-051-3/+3
| | | | llvm-svn: 92681
* Fix some struct/class specifier mismatches.Daniel Dunbar2010-01-051-3/+3
| | | | llvm-svn: 92550
* split 943 lines of instcombine out to a new InstCombineCasts.cppChris Lattner2010-01-041-0/+10
| | | | | | file. InstructionCombining.cpp is now down to a svelte 9300 lines :) llvm-svn: 92468
* split instcombine of compares (visit[FI]Cmp) out toChris Lattner2010-01-041-1/+17
| | | | | | a new InstCombineCompares.cpp file. llvm-svn: 92467
* move the 'SimplifyDemandedFoo' methods out to their own file, cutting 1K ↵Chris Lattner2010-01-041-5/+2
| | | | | | lines out of instcombine.cpp llvm-svn: 92465
* split the instcombine class definition out to a header shared Chris Lattner2010-01-041-0/+328
among the instcombine library. llvm-svn: 92463
OpenPOWER on IntegriCloud