summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Don't make TwoToExp signed by default.Bill Wendling2008-11-301-2/+1
| | | | llvm-svn: 60279
* From Hacker's Delight:Bill Wendling2008-11-301-8/+10
| | | | | | | | | | "For signed integers, the determination of overflow of x*y is not so simple. If x and y have the same sign, then overflow occurs iff xy > 2**31 - 1. If they have opposite signs, then overflow occurs iff xy < -2**31." In this case, x == -1. llvm-svn: 60278
* Instcombine was illegally transforming -X/C into X/-C when either X or CBill Wendling2008-11-301-3/+20
| | | | | | | | overflowed on negation. This commit checks to make sure that neithe C nor X overflows. This requires that the RHS of X (a subtract instruction) be a constant integer. llvm-svn: 60275
* Fix a fixme by making memdep's handling of allocations more logical.Chris Lattner2008-11-301-15/+12
| | | | | | | | If we see that a load depends on the allocation of its memory with no intervening stores, we now return a 'None' depedency instead of "Normal". This tweaks GVN to do its optimization with the new result. llvm-svn: 60267
* Eliminate the dropInstruction method, which is not needed any more.Chris Lattner2008-11-291-5/+2
| | | | | | Fix a subtle iterator invalidation bug I introduced in the last commit. llvm-svn: 60258
* Change MemDep::getNonLocalDependency to return its results asChris Lattner2008-11-291-5/+5
| | | | | | | a smallvector instead of a DenseMap. This speeds up GVN by 5% on 403.gcc. llvm-svn: 60255
* reimplement getNonLocalDependency with a simpler worklistChris Lattner2008-11-291-4/+21
| | | | | | | formulation that is faster and doesn't require nonLazyHelper. Much less code. llvm-svn: 60253
* Fix a thinko that manifested as a crash on clamav last night.Chris Lattner2008-11-291-2/+2
| | | | llvm-svn: 60251
* Split getDependency into getDependency and getDependencyFrom, the Chris Lattner2008-11-292-2/+2
| | | | | | | former does caching, the later doesn't. This dramatically simplifies the logic in getDependency and getDependencyFrom. llvm-svn: 60234
* Temporarily revert r60195. It's causing an optimized bootstrap of llvm-gcc ↵Bill Wendling2008-11-291-20/+21
| | | | | | to fail. llvm-svn: 60233
* Introduce and use a new MemDepResult class to hold the results of a memdepChris Lattner2008-11-293-54/+44
| | | | | | | | | | | query. This makes it crystal clear what cases can escape from MemDep that the clients have to handle. This also gives the clients a nice simplified interface to it that is easy to poke at. This patch also makes DepResultTy and MemoryDependenceAnalysis::DepType private, yay. llvm-svn: 60231
* Reimplement the internal abstraction used by MemDep in termsChris Lattner2008-11-293-52/+56
| | | | | | | | | | | | | | | of a pointer/int pair instead of a manually bitmangled pointer. This forces clients to think a little more about checking the appropriate pieces and will be useful for internal implementation improvements later. I'm not particularly happy with this. After going through this I don't think that the clients of memdep should be exposed to the internal type at all. I'll fix this in a subsequent commit. This has no functionality change. llvm-svn: 60230
* don't revisit instructions off the beginning of the block.Chris Lattner2008-11-281-2/+4
| | | | llvm-svn: 60221
* simplify some code, remove escaped newline.Chris Lattner2008-11-281-22/+28
| | | | llvm-svn: 60213
* don't call MergeBasicBlockIntoOnlyPred on a block whose onlyChris Lattner2008-11-282-11/+14
| | | | | | | predecessor is itself. This doesn't make sense, and this is a dead infinite loop anyway. llvm-svn: 60210
* rewrite RecursivelyDeleteTriviallyDeadInstructions to use a more efficientChris Lattner2008-11-281-16/+26
| | | | | | formulation that doesn't require set lookups or scanning a set. llvm-svn: 60203
* remove some weirdness that came from the LSR code that hasChris Lattner2008-11-281-8/+1
| | | | | | | nothing to do with dead instruction elimination. No tests in dejagnu depend on this, so I don't know what it was needed for. llvm-svn: 60202
* rewrite a big chunk of how DSE does recursive dead operand Chris Lattner2008-11-281-181/+105
| | | | | | | elimination to use more modern infrastructure. Also do a bunch of small cleanups. llvm-svn: 60201
* delete ErasePossiblyDeadInstructionTree, replacing uses of it withChris Lattner2008-11-271-41/+9
| | | | | | RecursivelyDeleteTriviallyDeadInstructions. llvm-svn: 60196
* Simplify LoopStrengthReduce::DeleteTriviallyDeadInstructions byChris Lattner2008-11-271-21/+20
| | | | | | | making it use RecursivelyDeleteTriviallyDeadInstructions to do the heavy lifting. llvm-svn: 60195
* enhance RecursivelyDeleteTriviallyDeadInstructions to makeChris Lattner2008-11-271-0/+9
| | | | | | PHIs dead if they are single-value. llvm-svn: 60194
* Enhance RecursivelyDeleteTriviallyDeadInstructions to optionallyChris Lattner2008-11-271-7/+15
| | | | | | return a list of deleted instructions. llvm-svn: 60193
* use continue to reduce indentationChris Lattner2008-11-271-18/+19
| | | | llvm-svn: 60192
* remove doConstantPropagation and dceInstruction, they are justChris Lattner2008-11-272-51/+26
| | | | | | | | | | wrappers around the interesting code and use an obscure iterator abstraction that dates back many many years. Move EraseDeadInstructions to Transforms/Utils and name it RecursivelyDeleteTriviallyDeadInstructions. llvm-svn: 60191
* simplify code.Chris Lattner2008-11-271-4/+12
| | | | llvm-svn: 60190
* simplify this logic.Chris Lattner2008-11-271-4/+6
| | | | llvm-svn: 60189
* Chris prefers icmp/select over udiv!Nick Lewycky2008-11-271-3/+11
| | | | llvm-svn: 60187
* Add a couple of missed optimizations on integer vectors. Multiply and divideNick Lewycky2008-11-271-6/+22
| | | | | | by 1, as well as multiply by -1. llvm-svn: 60182
* defensive patch: if CGP is merging a block with the entry block, make sureChris Lattner2008-11-271-1/+8
| | | | | | it ends up being the entry block. llvm-svn: 60180
* Fix PR3138: if we merge the entry block into another block, make sure toChris Lattner2008-11-271-0/+6
| | | | | | move the other block back up into the entry position! llvm-svn: 60179
* switch InstCombine::visitLoadInst to use Chris Lattner2008-11-272-45/+54
| | | | | | FindAvailableLoadedValue llvm-svn: 60169
* enhance FindAvailableLoadedValue to make use of AliasAnalysisChris Lattner2008-11-271-1/+20
| | | | | | if it has it. llvm-svn: 60167
* move FindAvailableLoadedValue from JumpThreading to Transforms/Utils.Chris Lattner2008-11-272-63/+65
| | | | llvm-svn: 60166
* simplify this code a bit.Chris Lattner2008-11-271-4/+4
| | | | llvm-svn: 60164
* Use the new MergeBasicBlockIntoOnlyPred function.Chris Lattner2008-11-271-19/+1
| | | | llvm-svn: 60163
* move MergeBasicBlockIntoOnlyPred to Transforms/Utils.Chris Lattner2008-11-272-31/+33
| | | | llvm-svn: 60162
* rename ThreadBlock to ProcessBlock, since it does other things thanChris Lattner2008-11-271-4/+4
| | | | | | just simple threading. llvm-svn: 60157
* Make jump threading substantially more powerful, in the following ways:Chris Lattner2008-11-271-0/+273
| | | | | | | | | | | | | | | | | 1. Make it fold blocks separated by an unconditional branch. This enables jump threading to see a broader scope. 2. Make jump threading able to eliminate locally redundant loads when they feed the branch condition of a block. This frequently occurs due to reg2mem running. 3. Make jump threading able to eliminate *partially redundant* loads when they feed the branch condition of a block. This is common in code with lots of loads and stores like C++ code and 255.vortex. This implements thread-loads.ll and rdar://6402033. Per the fixme's, several pieces of this should be moved into Transforms/Utils. llvm-svn: 60148
* Turn on my codegen prepare heuristic by default. It doesn't affect Chris Lattner2008-11-261-5/+1
| | | | | | | | | | performance in most cases on the Grawp tester, but does speed some things up (like shootout/hash by 15%). This also doesn't impact compile time in a noticable way on the Grawp tester. It also, of course, gets the testcase it was designed for right :) llvm-svn: 60120
* teach the new heuristic how to handle inline asm.Chris Lattner2008-11-261-7/+52
| | | | llvm-svn: 60088
* Improve ValueAlreadyLiveAtInst with a cheap and dirty, but effectiveChris Lattner2008-11-261-12/+32
| | | | | | | | | | | | | | | heuristic: the value is already live at the new memory operation if it is used by some other instruction in the memop's block. This is cheap and simple to compute (moreso than full liveness). This improves the new heuristic even more. For example, it cuts two out of three new instructions out of 255.vortex:DbmFileInGrpHdr, which is one of the functions that the heuristic regressed. This overall eliminates another 40 instructions from 403.gcc and visibly reduces register pressure in 255.vortex (though this only actually ends up saving the 2 instructions from the whole program). llvm-svn: 60084
* Start rewroking a subpiece of the profitability heuristic to beChris Lattner2008-11-261-11/+56
| | | | | | | | | | phrased in terms of liveness instead of as a horrible hack. :) In pratice, this doesn't change the generated code for either 255.vortex or 403.gcc, but it could cause minor code changes in theory. This is framework for coming changes. llvm-svn: 60082
* add a comment, make save/restore logic more obvious.Chris Lattner2008-11-261-7/+7
| | | | llvm-svn: 60076
* This adds in some code (currently disabled unless you pass Chris Lattner2008-11-261-10/+193
| | | | | | | | | | | | | | | | | | | | | | | | | -enable-smarter-addr-folding to llc) that gives CGP a better cost model for when to sink computations into addressing modes. The basic observation is that sinking increases register pressure when part of the addr computation has to be available for other reasons, such as having a use that is a non-memory operation. In cases where it works, it can substantially reduce register pressure. This code is currently an overall win on 403.gcc and 255.vortex (the two things I've been looking at), but there are several things I want to do before enabling it by default: 1. This isn't doing any caching of results, so it is much slower than it could be. It currently slows down release-asserts llc by 1.7% on 176.gcc: 27.12s -> 27.60s. 2. This doesn't think about inline asm memory operands yet. 3. The cost model botches the case when the needed value is live across the computation for other reasons. I'll continue poking at this, and eventually turn it on as llcbeta. llvm-svn: 60074
* Revert r60042. IndVarSimplify should check if APFloat is PPCDoubleDouble ↵Evan Cheng2008-11-261-0/+2
| | | | | | first before trying to convert it to an integer. llvm-svn: 60072
* Teach CodeGenPrepare to look through Bitcast instructions when attempting toChris Lattner2008-11-261-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | optimize addressing modes. This allows us to optimize things like isel-sink2.ll into: movl 4(%esp), %eax cmpb $0, 4(%eax) jne LBB1_2 ## F LBB1_1: ## TB movl $4, %eax ret LBB1_2: ## F movzbl 7(%eax), %eax ret instead of: _test: movl 4(%esp), %eax cmpb $0, 4(%eax) leal 4(%eax), %eax jne LBB1_2 ## F LBB1_1: ## TB movl $4, %eax ret LBB1_2: ## F movzbl 3(%eax), %eax ret This shrinks (e.g.) 403.gcc from 1133510 to 1128345 lines of .s. Note that the 2008-10-16-SpillerBug.ll testcase is dubious at best, I doubt it is really testing what it thinks it is. llvm-svn: 60068
* Teach MatchScaledValue to handle Scales by 1 with MatchAddr (whichChris Lattner2008-11-251-5/+15
| | | | | | | | can recursively match things) and scales by 0 by ignoring them. This triggers once in 403.gcc, saving 1 (!!!!) instruction in the whole huge app. llvm-svn: 60013
* significantly refactor all the addressing mode matching logicChris Lattner2008-11-251-139/+138
| | | | | | | | into a new AddressingModeMatcher class. This makes it easier to reason about and reduces passing around of stuff, but has no functionality change. llvm-svn: 60012
* refactor all the constantexpr/instruction handling code out into a Chris Lattner2008-11-251-65/+68
| | | | | | new FindMaximalLegalAddressingModeForOperation helper method. llvm-svn: 60011
* another minor tweakChris Lattner2008-11-251-3/+2
| | | | llvm-svn: 60010
OpenPOWER on IntegriCloud