summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Factor address mode matcher out of codegen prepare to make it available to ↵Evan Cheng2009-02-201-643/+1
| | | | | | other passes, e.g. loop strength reduction. llvm-svn: 65134
* In CodeGenPrepare's debug output, use WriteAsOperand instead ofDan Gohman2009-02-131-6/+16
| | | | | | printing getName(), so that unnamed values are printed correctly. llvm-svn: 64468
* fix PR3537: if resetting bbi back to the start of a block, we need toChris Lattner2009-02-121-4/+9
| | | | | | forget about already inserted expressions. llvm-svn: 64362
* Simplify the logic of getting hold of a PHI predecessor block.Gabor Greif2009-01-231-2/+1
| | | | | | | | | There is now a direct way from value-use-iterator to incoming block in PHINode's API. This way we avoid the iterator->index->iterator trip, and especially the costly getOperandNo() invocation. Additionally there is now an assertion that the iterator really refers to one of the PHI's Uses. llvm-svn: 62869
* Fix rdar://6505632, an llc crash on 483.xalancbmkChris Lattner2009-01-181-1/+2
| | | | llvm-svn: 62470
* Rename getABITypeSize to getTypePaddedSize, asDuncan Sands2009-01-121-1/+1
| | | | | | suggested by Chris. llvm-svn: 62099
* Find loop back edges only after empty blocks are eliminated.Evan Cheng2009-01-051-2/+3
| | | | llvm-svn: 61752
* - CodeGenPrepare does not split loop back edges but it only knows about back ↵Evan Cheng2008-12-191-45/+135
| | | | | | | | edges of single block loops. It now does a DFS walk to find loop back edges. - Use SplitBlockPredecessors to factor out common predecessors of the critical edge destination. This is disabled for now due to some regressions. llvm-svn: 61248
* don't call MergeBasicBlockIntoOnlyPred on a block whose onlyChris Lattner2008-11-281-10/+12
| | | | | | | predecessor is itself. This doesn't make sense, and this is a dead infinite loop anyway. llvm-svn: 60210
* remove doConstantPropagation and dceInstruction, they are justChris Lattner2008-11-271-21/+1
| | | | | | | | | | 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
* 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
* Use the new MergeBasicBlockIntoOnlyPred function.Chris Lattner2008-11-271-19/+1
| | | | llvm-svn: 60163
* 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
* 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
* minor cleanups no functionality change.Chris Lattner2008-11-251-32/+31
| | | | llvm-svn: 60009
* rearrange and tidy some code, no functionality change.Chris Lattner2008-11-241-53/+52
| | | | llvm-svn: 59990
* minor cleanups to debug code, no functionality change.Chris Lattner2008-11-241-24/+33
| | | | llvm-svn: 59989
* reenable the right part of the code.Chris Lattner2008-11-241-1/+1
| | | | llvm-svn: 59985
* revert an accidental commit, this fixes the regression on ↵Chris Lattner2008-11-241-4/+1
| | | | | | test/CodeGen/X86/isel-sink.ll llvm-svn: 59976
* Fix 3113: If we have a dead cyclic PHI, replace the whole thingChris Lattner2008-11-241-1/+7
| | | | | | with an undef. llvm-svn: 59972
* Commit CodeGenPrepare.cpp changes which was accidentially left out of 56526.Evan Cheng2008-09-241-19/+2
| | | | llvm-svn: 56549
* Fix fallout in CodeGenPrepare from 56526. Will likely need more work.Eric Christopher2008-09-241-119/+136
| | | | llvm-svn: 56546
* Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman2008-09-041-1/+1
| | | | llvm-svn: 55779
* Rename SDOperand to SDValue.Dan Gohman2008-07-271-1/+1
| | | | llvm-svn: 54128
* Remove comparison methods for MVT. The main causeDuncan Sands2008-06-081-2/+2
| | | | | | | | | | | of apint codegen failure is the DAG combiner doing the wrong thing because it was comparing MVT's using < rather than comparing the number of bits. Removing the < method makes this mistake impossible to commit. Instead, add helper methods for comparing bits and use them. llvm-svn: 52098
* Wrap MVT::ValueType in a struct to get type safetyDuncan Sands2008-06-061-3/+3
| | | | | | | | | | | | | | | | and better control the abstraction. Rename the type to MVT. To update out-of-tree patches, the main thing to do is to rename MVT::ValueType to MVT, and rewrite expressions like MVT::getSizeInBits(VT) in the form VT.getSizeInBits(). Use VT.getSimpleVT() to extract a MVT::SimpleValueType for use in switch statements (you will get an assert failure if VT is an extended value type - these shouldn't exist after type legalization). This results in a small speedup of codegen and no new testsuite failures (x86-64 linux). llvm-svn: 52044
* Tidy up BasicBlock::getFirstNonPHI, and change a bunch of places toDan Gohman2008-05-231-6/+3
| | | | | | use it instead of duplicating its functionality. llvm-svn: 51499
* API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. ↵Gabor Greif2008-05-161-6/+6
| | | | | | Legacy interfaces will be in place for some time. (Merge from use-diet branch.) llvm-svn: 51200
* Clean up the use of static and anonymous namespaces. This turned upDan Gohman2008-05-131-0/+3
| | | | | | | several things that were neither in an anonymous namespace nor static but not intended to be global. llvm-svn: 51017
* Improve pass documentation and comments.Gordon Henriksen2008-05-081-2/+2
| | | | | | Patch by Matthijs Kooijman! llvm-svn: 50861
* Implement a signficant optimization for inline asm:Chris Lattner2008-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | When choosing between constraints with multiple options, like "ir", test to see if we can use the 'i' constraint and go with that if possible. This produces more optimal ASM in all cases (sparing a register and an instruction to load it), and fixes inline asm like this: void test () { asm volatile (" %c0 %1 " : : "imr" (42), "imr"(14)); } Previously we would dump "42" into a memory location (which is ok for the 'm' constraint) which would cause a problem because the 'c' modifier is not valid on memory operands. Isn't it great how inline asm turns 'missed optimization' into 'compile failed'?? Incidentally, this was the todo in PowerPC/2007-04-24-InlineAsm-I-Modifier.ll Please do NOT pull this into Tak. llvm-svn: 50315
* Move a bunch of inline asm code out of line.Chris Lattner2008-04-271-1/+1
| | | | llvm-svn: 50313
* Remove the code from CodeGenPrepare that moved getresult instructionsDan Gohman2008-04-251-9/+0
| | | | | | | | | | | to the block that defines their operands. This doesn't work in the case that the operand is an invoke, because invoke is a terminator and must be the last instruction in a block. Replace it with support in SelectionDAGISel for copying struct values into sequences of virtual registers. llvm-svn: 50279
* silence a warning when assertions are disabled.Chris Lattner2008-04-061-1/+1
| | | | llvm-svn: 49283
* Handle getresult instructions in different basic blocksDan Gohman2008-03-211-0/+9
| | | | | | | from their aggregate operands by moving the getresult instructions. llvm-svn: 48657
* Remove dead options.Evan Cheng2008-03-191-7/+1
| | | | llvm-svn: 48556
* fix http://llvm.org/bugs/show_bug.cgi?id=2097Gabor Greif2008-02-261-1/+1
| | | | llvm-svn: 47615
* Fix for pr2093: direct operands aren't necessarily addresses, so don't Eli Friedman2008-02-261-1/+2
| | | | | | try to simplify them. llvm-svn: 47610
* Fix PR2076. CodeGenPrepare now sinks address computation for inline asm memoryEvan Cheng2008-02-261-0/+55
| | | | | | operands into inline asm block. llvm-svn: 47589
* Make sure the caller doesn't use freed memory.Duncan Sands2008-01-201-1/+3
| | | | | | Fixes PR1935. llvm-svn: 46203
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
OpenPOWER on IntegriCloud