aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Simplify some code (first hunk) and fix PR5208 (second hunk) byChris Lattner2009-10-171-8/+6
| | | | | | | updating the callgraph when introducing a call. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84310 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove MallocInst from LLVM Instructions.Victor Hernandez2009-10-175-457/+15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84299 91177308-0d34-0410-b5e6-96231b3b80d8
* Autoupgrade malloc insts to malloc calls.Victor Hernandez2009-10-173-118/+40
| | | | | | | | | | Update testcases that rely on malloc insts being present. Also prematurely remove MallocInst handling from IndMemRemoval and RaiseAllocations to help pass tests in this incremental step. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84292 91177308-0d34-0410-b5e6-96231b3b80d8
* HeapAllocSRoA also needs to check if malloc array size can be computed.Victor Hernandez2009-10-161-36/+40
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84288 91177308-0d34-0410-b5e6-96231b3b80d8
* Move zext and sext casts fed by loads into the same block as theDan Gohman2009-10-161-1/+41
| | | | | | | | load, to help SelectionDAG fold them into the loads, unless conditions are unfavorable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84271 91177308-0d34-0410-b5e6-96231b3b80d8
* Strip trailing white space.Duncan Sands2009-10-161-33/+31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84256 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix bug where array malloc with unexpected computation of the size argument ↵Victor Hernandez2009-10-151-17/+17
| | | | | | | | | | | | | | | | | | | | | | resulted in MallocHelper identifying the malloc as a non-array malloc. This broke GlobalOpt's optimization of stores of mallocs to global variables. The fix is to classify malloc's into 3 categories: 1. non-array mallocs 2. array mallocs whose array size can be determined 3. mallocs that cannot be determined to be of type 1 or 2 and cannot be optimized getMallocArraySize() returns NULL for category 3, and all users of this function must avoid their malloc optimization if this function returns NULL. Eventually, currently unexpected codegen for computing the malloc's size argument will be supported in isArrayMalloc() and getMallocArraySize(), extending malloc optimizations to those examples. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84199 91177308-0d34-0410-b5e6-96231b3b80d8
* only try to fold constantexpr operands when the worklist is first populated, Chris Lattner2009-10-151-15/+30
| | | | | | | | | | don't bother every time going around the main worklist. This speeds up a release-asserts opt -std-compile-opts on 403.gcc by about 4% (1.5s). It seems to speed up the most expensive instances of instcombine by ~10%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84171 91177308-0d34-0410-b5e6-96231b3b80d8
* don't bother calling ConstantFoldInstruction unless there is a use of theChris Lattner2009-10-151-22/+25
| | | | | | | | | | | instruction (which disqualifies stores, unreachable, etc) and at least the first operand is a constant. This filters out a lot of obvious cases that can't be folded. Also, switch the IRBuilder to a TargetFolder, which tries harder. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84170 91177308-0d34-0410-b5e6-96231b3b80d8
* Use isVoidTy()Devang Patel2009-10-144-12/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84118 91177308-0d34-0410-b5e6-96231b3b80d8
* make instcombine's instruction sinking more aggressive in theChris Lattner2009-10-141-3/+10
| | | | | | | presence of PHI nodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84103 91177308-0d34-0410-b5e6-96231b3b80d8
* Check void type before using RAUWd.Devang Patel2009-10-133-7/+27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84049 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not check use_empty() before replaceAllUsesWith(). This gives ↵Devang Patel2009-10-133-15/+11
| | | | | | ValueHandles a chance to get properly updated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84033 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new CodeMetrics class to compute code size instead ofDan Gohman2009-10-131-6/+6
| | | | | | | manually counting instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84016 91177308-0d34-0410-b5e6-96231b3b80d8
* Update CMake file.Ted Kremenek2009-10-131-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84001 91177308-0d34-0410-b5e6-96231b3b80d8
* Commit the removal of this file, which is now moved to lib/Analysis.Dan Gohman2009-10-131-337/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83999 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the InlineCost code from Transforms/Utils to Analysis.Dan Gohman2009-10-133-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83998 91177308-0d34-0410-b5e6-96231b3b80d8
* Start refactoring the inline cost estimation code so that it can be usedDan Gohman2009-10-131-71/+71
| | | | | | | for purposes other than inlining. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83997 91177308-0d34-0410-b5e6-96231b3b80d8
* change simplifycfg to not duplicate 'unwind' instructions. HopefullyChris Lattner2009-10-131-12/+5
| | | | | | | | this will increase the likelihood of common code getting sunk towards the unwind. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83996 91177308-0d34-0410-b5e6-96231b3b80d8
* Make LoopUnswitch's cost estimation count Instructions, rather thanDan Gohman2009-10-131-19/+7
| | | | | | | | | BasicBlocks, so that it doesn't blindly procede in the presence of large individual BasicBlocks. This addresses a class of code-size expansion problems. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83992 91177308-0d34-0410-b5e6-96231b3b80d8
* Make licm debug message readable.Evan Cheng2009-10-121-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83908 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix warning.Dale Johannesen2009-10-121-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83870 91177308-0d34-0410-b5e6-96231b3b80d8
* populate instcombine's initial worklist more carefully, causingChris Lattner2009-10-121-18/+26
| | | | | | | | | | | | it to visit instructions from the start of the function to the end of the function in the first path. This greatly speeds up some pathological cases (e.g. PR5150). Try #3, this time with some unneeded debug info stuff removed which was causing dead pointers to be added to the worklist. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83818 91177308-0d34-0410-b5e6-96231b3b80d8
* revert r83814 for now, it is making the llvm-gcc bootstrap unhappy.Chris Lattner2009-10-111-26/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83817 91177308-0d34-0410-b5e6-96231b3b80d8
* populate instcombine's initial worklist more carefully, causingChris Lattner2009-10-111-1/+26
| | | | | | | | | | it to visit instructions from the start of the function to the end of the function in the first path. This greatly speeds up some pathological cases (e.g. PR5150). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83814 91177308-0d34-0410-b5e6-96231b3b80d8
* remove some harmful code that would turn an insertelement on an undefChris Lattner2009-10-111-22/+0
| | | | | | | | | | | | into a shuffle even if it was used by another insertelement. If the visitation order of instcombine was wrong, this would turn a chain of insertelements into a chain of shufflevectors, which was quite painful. Since CollectShuffleElements handles these cases, the code can just be nuked. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83810 91177308-0d34-0410-b5e6-96231b3b80d8
* teach instcombine to simplify xor's harder, catching theChris Lattner2009-10-111-0/+27
| | | | | | | new testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83799 91177308-0d34-0410-b5e6-96231b3b80d8
* cleanupsChris Lattner2009-10-111-20/+18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83797 91177308-0d34-0410-b5e6-96231b3b80d8
* cleanup, no functionality change.Chris Lattner2009-10-111-34/+33
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83795 91177308-0d34-0410-b5e6-96231b3b80d8
* generalize a transformation even more: we don't care whether theChris Lattner2009-10-111-12/+10
| | | | | | | | | | input the the mul is a zext from bool, just that it is all zeros other than the low bit. This fixes some phase ordering issues that would cause us to miss some xforms in mul.ll when the worklist is visited differently. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83794 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify a transformation by making it more general.Chris Lattner2009-10-111-32/+14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83792 91177308-0d34-0410-b5e6-96231b3b80d8
* temporarily revert previous patchChris Lattner2009-10-111-14/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83791 91177308-0d34-0410-b5e6-96231b3b80d8
* populate instcombine's initial worklist more carefully, causingChris Lattner2009-10-111-1/+14
| | | | | | | | | it to visit instructions from the start of the function to the end of the function in the first path. This greatly speeds up some pathological cases (e.g. PR5150). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83790 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove CleanupDbgInfo, instcombine does this and its not worth duplicating itEdwin Török2009-10-111-35/+0
| | | | | | | here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83789 91177308-0d34-0410-b5e6-96231b3b80d8
* LICM shouldn't sink/delete debug information. Fix this and add a testcase.Edwin Török2009-10-111-1/+39
| | | | | | | | For now the metadata of sinked/hoisted instructions is still wrong, but that'll be fixed when instructions will have debug metadata directly attached. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83786 91177308-0d34-0410-b5e6-96231b3b80d8
* when folding duplicate conditions, delete the Chris Lattner2009-10-111-0/+2
| | | | | | | now-probably-dead instruction tree feeding it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83778 91177308-0d34-0410-b5e6-96231b3b80d8
* implement rdar://7293527, a trivial instcombine that llvm-gccChris Lattner2009-10-111-1/+12
| | | | | | | | gets but clang doesn't, because it is implemented in GCC's fold routine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83761 91177308-0d34-0410-b5e6-96231b3b80d8
* implement a transformation in jump threading that is currentlyChris Lattner2009-10-111-64/+218
| | | | | | | | | | | done by condprop, but do it in a much more general form. The basic idea is that we can do a limited form of tail duplication in the case when we have a branch on a phi. Moving the branch up in to the predecessor block makes instruction selection much easier and encourages chained jump threadings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83759 91177308-0d34-0410-b5e6-96231b3b80d8
* restructure some code, no functionality change.Chris Lattner2009-10-111-33/+29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83756 91177308-0d34-0410-b5e6-96231b3b80d8
* factor some code better and move a function, no functionality change.Chris Lattner2009-10-111-81/+55
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83755 91177308-0d34-0410-b5e6-96231b3b80d8
* make jump threading on a phi with undef inputs happen.Chris Lattner2009-10-111-28/+54
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83754 91177308-0d34-0410-b5e6-96231b3b80d8
* rewrite LCSSA to use SSAUpdate, to only return true if it modifiesChris Lattner2009-10-111-154/+130
| | | | | | | the IR, and to implement the FIXME'd optimization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83748 91177308-0d34-0410-b5e6-96231b3b80d8
* clean up and simplify some code. Don't use setvector when things will beChris Lattner2009-10-111-28/+23
| | | | | | | | inserted only once, just use vector. Don't compute ExitBlocks unless we need it, change std::sort to array_pod_sort. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83747 91177308-0d34-0410-b5e6-96231b3b80d8
* switch GVN to use SSAUpdater. Besides removing a lot of complexityChris Lattner2009-10-101-151/+38
| | | | | | | | | from GVN, this also speeds it up, inserts fewer PHI nodes (see the testcase) and allows it to remove more loads (due to fewer PHI nodes standing in the way). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83746 91177308-0d34-0410-b5e6-96231b3b80d8
* add a simple helper method.Chris Lattner2009-10-101-0/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83745 91177308-0d34-0410-b5e6-96231b3b80d8
* add ability for clients of SSAUpdater to find out about theChris Lattner2009-10-101-1/+9
| | | | | | | PHI nodes inserted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83744 91177308-0d34-0410-b5e6-96231b3b80d8
* remove dead codeChris Lattner2009-10-101-65/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83742 91177308-0d34-0410-b5e6-96231b3b80d8
* add the ability to get a rewritten value from the middle of a block,Chris Lattner2009-10-101-3/+92
| | | | | | | | not just at the end. Add a big comment explaining when this could be useful (which never happens for jump threading). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83741 91177308-0d34-0410-b5e6-96231b3b80d8
* rename GetValueInBlock -> GetValueAtEndOfBlock to better reflect Chris Lattner2009-10-101-11/+11
| | | | | | | what it does. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83740 91177308-0d34-0410-b5e6-96231b3b80d8
* use a typedef instead of spelling out an insane type. Yay for auto someday.Chris Lattner2009-10-101-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83707 91177308-0d34-0410-b5e6-96231b3b80d8