summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
...
* Make more passes preserve dominators (or state that they preserve dominators ifCameron Zwarich2011-01-082-0/+18
| | | | | | | | | | they all ready do). This removes two dominator recomputations prior to isel, which is a 1% improvement in total llc time for 403.gcc. The only potentially suspect thing is making GCStrategy recompute dominators if it used a custom lowering strategy. llvm-svn: 123064
* Contract subloop bodies. However, it is still important to visit the phis at theCameron Zwarich2011-01-081-7/+41
| | | | | | top of subloop headers, as the phi uses logically occur outside of the subloop. llvm-svn: 123062
* Fix a bug in r123034 (trying to sext/zext non-integers) and clean up a little.Frits van Bommel2011-01-081-5/+8
| | | | llvm-svn: 123061
* Have loop-rotate simplify instructions (yay instsimplify!) as it clonesChris Lattner2011-01-081-5/+21
| | | | | | | | | | | | them into the loop preheader, eliminating silly instructions like "icmp i32 0, 100" in fixed tripcount loops. This also better exposes the bigger problem with loop rotate that I'd like to fix: once this has been folded, the duplicated conditional branch *often* turns into an uncond branch. Not aggressively handling this is pessimizing later loop optimizations somethin' fierce by making "dominates all exit blocks" checks fail. llvm-svn: 123060
* Revamp the ValueMapper interfaces in a couple ways:Chris Lattner2011-01-085-135/+81
| | | | | | | | | | | | | | | | 1. Take a flags argument instead of a bool. This makes it more clear to the reader what it is used for. 2. Add a flag that says that "remapping a value not in the map is ok". 3. Reimplement MapValue to share a bunch of code and be a lot more efficient. For lookup failures, don't drop null values into the map. 4. Using the new flag a bunch of code can vaporize in LinkModules and LoopUnswitch, kill it. No functionality change. llvm-svn: 123058
* two minor changes: switch to the standard ValueToValueMapTyChris Lattner2011-01-081-2/+7
| | | | | | | | map from ValueMapper.h (giving us access to its utilities) and add a fastpath in the loop rotation code, avoiding expensive ssa updator manipulation for values with nothing to update. llvm-svn: 123057
* InstCombine: Match min/max hidden by sext/zextTobias Grosser2011-01-071-35/+70
| | | | | | | | | | | | | | | X = sext x; x >s c ? X : C+1 --> X = sext x; X <s C+1 ? C+1 : X X = sext x; x <s c ? X : C-1 --> X = sext x; X >s C-1 ? C-1 : X X = zext x; x >u c ? X : C+1 --> X = zext x; X <u C+1 ? C+1 : X X = zext x; x <u c ? X : C-1 --> X = zext x; X >u C-1 ? C-1 : X X = sext x; x >u c ? X : C+1 --> X = sext x; X <u C+1 ? C+1 : X X = sext x; x <u c ? X : C-1 --> X = sext x; X >u C-1 ? C-1 : X Instead of calculating this with mixed types promote all to the larger type. This enables scalar evolution to analyze this expression. PR8866 llvm-svn: 123034
* Some whitespace fixesTobias Grosser2011-01-071-24/+24
| | | | llvm-svn: 123033
* Revert 122959, it needs more thought. Add it back to README.txt with ↵Benjamin Kramer2011-01-071-4/+0
| | | | | | additional notes. llvm-svn: 123030
* Remove all uses of the "ugly" method BranchInst::setUnconditionalDest().Jay Foad2011-01-072-6/+9
| | | | llvm-svn: 123025
* InstCombine: Turn _chk functions into the "unsafe" variant if length and max ↵Benjamin Kramer2011-01-061-0/+2
| | | | | | | | langth are equal. This happens when we take the (non-constant) length from a malloc. llvm-svn: 122961
* InstCombine: If we call llvm.objectsize on a malloc call we can replace it ↵Benjamin Kramer2011-01-061-1/+5
| | | | | | with the size passed to malloc. llvm-svn: 122959
* InstCombine: Teach llvm.objectsize folding to look through GEPs.Benjamin Kramer2011-01-061-50/+41
| | | | llvm-svn: 122958
* Add the CallInst optimizations that don't involve expanding inline assembly toCameron Zwarich2011-01-061-0/+7
| | | | | | OptimizeInst() so that they can be used on a worklist instruction. llvm-svn: 122945
* Move the GEP handling in CodeGenPrepare to OptimizeInst().Cameron Zwarich2011-01-061-12/+12
| | | | llvm-svn: 122944
* Split the optimizations in CodeGenPrepare that don't manipulate the iteratorsCameron Zwarich2011-01-061-41/+52
| | | | | | | into a separate function, so that it can be called from a loop using a worklist rather than a loop traversing a whole basic block. llvm-svn: 122943
* Zap the last two -Wself-assign warnings in llvm.Jakob Stoklund Olesen2011-01-061-1/+2
| | | | | | Simplify RALinScan::DowngradeRegister with TRI::getOverlaps while we are there. llvm-svn: 122940
* Stop reallocating SunkAddrs for each basic block. When we move to an instructionCameron Zwarich2011-01-061-4/+10
| | | | | | worklist, the key will need to become std::pair<BasicBlock*, Value*>. llvm-svn: 122932
* Add some more statistics to CodeGenPrepare.Cameron Zwarich2011-01-051-0/+4
| | | | llvm-svn: 122891
* Add some stats to CodeGenPrepare to make it easier to speed it up withoutCameron Zwarich2011-01-051-3/+15
| | | | | | regressing code quality. llvm-svn: 122887
* Use pop_back_val instead of back followed by pop_back.Cameron Zwarich2011-01-051-2/+1
| | | | llvm-svn: 122876
* Use a worklist for later iterations just like ordinary instsimplify. The nextCameron Zwarich2011-01-051-0/+19
| | | | | | | step is to only process instructions in subloops if they have been modified by an earlier simplification. llvm-svn: 122869
* Change LoopInstSimplify back to a LoopPass. It revisits subloops rather thanCameron Zwarich2011-01-051-10/+36
| | | | | | | | | | skipping them, but it should probably use a worklist and only revisit those instructions in subloops that have actually changed. It should probably also use a worklist after the first iteration like instsimplify now does. Regardless, it's only 0.3% of opt -O2 time on 403.gcc if it replaces the instcombine placed in the middle of the loop passes. llvm-svn: 122868
* Don't bother value numbering instructions with void types in GVN. In theory ↵Owen Anderson2011-01-041-0/+4
| | | | | | | | | this should allow us to insert fewer things into the value numbering maps, but any speedup is beneath the noise threshold on my machine on 403.gcc. llvm-svn: 122844
* Complete the NumberTable --> LeaderTable rename.Owen Anderson2011-01-041-12/+12
| | | | llvm-svn: 122828
* Fix typo in a comment.Owen Anderson2011-01-041-1/+1
| | | | llvm-svn: 122827
* Prune #include's.Owen Anderson2011-01-041-10/+0
| | | | llvm-svn: 122826
* Clarify terminology, settling on referring to what was the "number table" as ↵Owen Anderson2011-01-041-32/+32
| | | | | | | | the "leader table", and rename methods to make it much more clear what they're doing. llvm-svn: 122823
* When removing a value from GVN's leaders list, don't drop the Next pointer ↵Owen Anderson2011-01-041-1/+2
| | | | | | in a corner case. llvm-svn: 122822
* Improve the accuracy of the inlining heuristic looking for theDale Johannesen2011-01-041-9/+14
| | | | | | | | | | case where a static caller is itself inlined everywhere else, and thus may go away if it doesn't get too big due to inlining other things into it. If there are references to the caller other than calls, it will not be removed; account for this. This results in same-day completion of the case in PR8853. llvm-svn: 122821
* Branch instructions don't produce values, so there's no need to generate a ↵Owen Anderson2011-01-041-5/+3
| | | | | | | | | value number for them. This avoids adding them to the various value numbering tables, resulting in a minor (~3%) speedup for GVN on 40.gcc. llvm-svn: 122819
* Remove commented out code.Owen Anderson2011-01-041-4/+0
| | | | llvm-svn: 122817
* Switch to the new style of asterisk placement.Cameron Zwarich2011-01-041-8/+8
| | | | llvm-svn: 122815
* Teach loop-idiom to turn a loop containing a memset into a larger memsetChris Lattner2011-01-041-18/+69
| | | | | | | | | | | | | | | | when safe. The testcase is basically this nested loop: void foo(char *X) { for (int i = 0; i != 100; ++i) for (int j = 0; j != 100; ++j) X[j+i*100] = 0; } which gets turned into a single memset now. clang -O3 doesn't optimize this yet though due to a phase ordering issue I haven't analyzed yet. llvm-svn: 122806
* restructure this a bit. Initialize the WeakVH with "I", theChris Lattner2011-01-041-11/+14
| | | | | | | | instruction *after* the store. The store will always be deleted if the transformation kicks in, so we'd do an N^2 scan of every loop block. Whoops. llvm-svn: 122805
* Avoid finding loop back edges when we are not splitting critical edges inCameron Zwarich2011-01-041-2/+4
| | | | | | CodeGenPrepare (which is the default behavior). llvm-svn: 122801
* Address most of Duncan's review comments. Also, make LoopInstSimplify a simpleCameron Zwarich2011-01-041-37/+15
| | | | | | | | | | | | FunctionPass. It probably doesn't have a reason to be a LoopPass, as it will probably drop the simple fixed point and either use RPO iteration or Duncan's approach in instsimplify of only revisiting instructions that have changed. The next step is to preserve LoopSimplify. This looks like it won't be too hard, although the pass manager doesn't actually seem to respect when non-loop passes claim to preserve LCSSA or LoopSimplify. This will have to be fixed. llvm-svn: 122791
* use the very-handy getTruncateOrZeroExtend helper function, andChris Lattner2011-01-041-14/+6
| | | | | | | stop setting NSW: signed overflow is possible. Thanks to Dan for pointing these out. llvm-svn: 122790
* Fix comment.Owen Anderson2011-01-031-1/+1
| | | | llvm-svn: 122788
* Use the new addEscapingValue callback to update GlobalsModRef when GVN adds ↵Owen Anderson2011-01-031-2/+19
| | | | | | | | PHIs of GEPs. For the moment, have GlobalsModRef handle this conservatively by simply removing the value from its maps. llvm-svn: 122787
* Duncan deftly points out that readnone functions aren'tChris Lattner2011-01-031-1/+5
| | | | | | | invalidated by stores, so they can be handled as 'simple' operations. llvm-svn: 122785
* Simplify GVN's value expression structure, allowing the elimination of a lot of Owen Anderson2011-01-031-260/+26
| | | | | | almost-but-not-quite-identical code. No intended functionality change. llvm-svn: 122760
* stength reduce my previous patch a bit. The only instructionsChris Lattner2011-01-031-6/+9
| | | | | | | | | | | that are allowed to have metadata operands are intrinsic calls, and the only ones that take metadata currently return void. Just reject all void instructions, which should not be value numbered anyway. To future proof things, add an assert to the getHashValue impl for calls to check that metadata operands aren't present. llvm-svn: 122759
* fix PR8895: metadata operands don't have a strong use of theirChris Lattner2011-01-031-4/+10
| | | | | | | | | | nested values, so they can change and drop to null, which can change the hash and cause havok. It turns out that it isn't a good idea to value number stuff with metadata operands anyway, so... don't. llvm-svn: 122758
* Speed up instsimplify by about 10-15% by not bothering to retryDuncan Sands2011-01-031-8/+19
| | | | | | | InstructionSimplify on instructions that didn't change since the last time round the loop. llvm-svn: 122745
* Switch a worklist in CodeGenPrepare to SmallVector and increase the inlineCameron Zwarich2011-01-031-2/+2
| | | | | | | | | capacity on the Visited SmallPtrSet. On 403.gcc, this is about a 4.5% speedup of CodeGenPrepare time (which itself is 10% of time spent in the backend). This is progress towards PR8889. llvm-svn: 122741
* earlycse can do trivial with-a-block dead store Chris Lattner2011-01-031-6/+38
| | | | | | | elimination as well. This deletes 60 stores in 176.gcc that largely come from bitfield code. llvm-svn: 122736
* switch the load table to use a recycling bump pointer allocator,Chris Lattner2011-01-031-1/+4
| | | | | | speeding earlycse up by 6%. llvm-svn: 122733
* now that loads are in their own table, we can implementChris Lattner2011-01-031-1/+12
| | | | | | | store->load forwarding. This allows EarlyCSE to zap 600 more loads from 176.gcc. llvm-svn: 122732
* split loads and calls into separate tables. Loads are now just indexedChris Lattner2011-01-031-42/+74
| | | | | | by their pointer instead of using MemoryValue to wrap it. llvm-svn: 122731
OpenPOWER on IntegriCloud