summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombine.h
Commit message (Collapse)AuthorAgeFilesLines
* 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