aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Tighten up a check for folding away loads from (newly constant) globals. ThisChris Lattner2007-11-091-6/+11
| | | | | | | | fixes a crash on Transforms/GlobalOpt/2007-11-09-GEP-GEP-Crash.ll and rdar://5585488. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43949 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix indentAnton Korobeynikov2007-11-091-12/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43941 91177308-0d34-0410-b5e6-96231b3b80d8
* Forget to commit users part of value mapper interfaceAnton Korobeynikov2007-11-094-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43940 91177308-0d34-0410-b5e6-96231b3b80d8
* And delete this oneAnton Korobeynikov2007-11-091-29/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43939 91177308-0d34-0410-b5e6-96231b3b80d8
* Better checkAndrew Lenharth2007-11-081-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43897 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR1780Andrew Lenharth2007-11-081-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43893 91177308-0d34-0410-b5e6-96231b3b80d8
* fix const correctness, BB is const, so its predecessors are tooChris Lattner2007-11-061-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43780 91177308-0d34-0410-b5e6-96231b3b80d8
* don't put erase or query for non-allocainst pointers in an set of allocainsts*'sChris Lattner2007-11-061-3/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43779 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement PR1777 by detecting dependent phis thatChris Lattner2007-11-061-0/+62
| | | | | | | all compute the same value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43777 91177308-0d34-0410-b5e6-96231b3b80d8
* At the point of calculating the shift amount, theDuncan Sands2007-11-061-2/+3
| | | | | | | | type of SV has changed from what it originally was. However we need the store width of the original. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43775 91177308-0d34-0410-b5e6-96231b3b80d8
* wrap long linesChris Lattner2007-11-061-2/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43745 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an abort in instcombine when folding creates a vector rem instruction.Dan Gohman2007-11-051-5/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43743 91177308-0d34-0410-b5e6-96231b3b80d8
* If a value is incoming from outside the loop then the value does not need ↵Devang Patel2007-11-051-3/+0
| | | | | | remapping and the value is never tracked through LastValueMap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43728 91177308-0d34-0410-b5e6-96231b3b80d8
* Deleting redundant copy of block extractor pass. See also PR1775.Gordon Henriksen2007-11-051-2/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43694 91177308-0d34-0410-b5e6-96231b3b80d8
* If a long double is in a packed struct, it may beDuncan Sands2007-11-051-5/+7
| | | | | | | that there is no padding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43691 91177308-0d34-0410-b5e6-96231b3b80d8
* Finishing initial docs for all transformations in Passes.html.Gordon Henriksen2007-11-045-22/+20
| | | | | | Also cleaned up some comments in source files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43674 91177308-0d34-0410-b5e6-96231b3b80d8
* Change uses of getTypeSize to getABITypeSize, getTypeStoreSizeDuncan Sands2007-11-041-44/+56
| | | | | | | | | | | | | | | | | | | | | | | or getTypeSizeInBits as appropriate in ScalarReplAggregates. The right change to make was not always obvious, so it would be good to have an sroa guru review this. While there I noticed some bugs, and fixed them: (1) arrays of x86 long double have holes due to alignment padding, but this wasn't being spotted by HasStructPadding (renamed to HasPadding). The same goes for arrays of oddly sized ints. Vectors also suffer from this, in fact the problem for vectors is much worse because basic vector assumptions seem to be broken by vectors of type with alignment padding. I didn't try to fix any of these vector problems. (2) The code for extracting smaller integers from larger ones (in the "int union" case) was wrong on big-endian machines for integers with size not a multiple of 8, like i1. Probably this is impossible to hit via llvm-gcc, but I fixed it anyway while there and added a testcase. I also got rid of some trailing whitespace and changed a function name which had an obvious typo in it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43672 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable tail duplication of call instructions. The costChris Lattner2007-11-041-0/+5
| | | | | | | | | metric is way off for these in general, and this works around buggy code like that in PR1764. we'll see if there is a big performance impact of this. If so, I'll revert it tomorrow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43668 91177308-0d34-0410-b5e6-96231b3b80d8
* Add std:: to sort calls.Dan Gohman2007-11-021-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43652 91177308-0d34-0410-b5e6-96231b3b80d8
* Change illegal uses of ++ to uses of STLExtra.h's next function.Dan Gohman2007-11-021-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43651 91177308-0d34-0410-b5e6-96231b3b80d8
* Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.Duncan Sands2007-11-018-29/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The meaning of getTypeSize was not clear - clarifying it is important now that we have x86 long double and arbitrary precision integers. The issue with long double is that it requires 80 bits, and this is not a multiple of its alignment. This gives a primitive type for which getTypeSize differed from getABITypeSize. For arbitrary precision integers it is even worse: there is the minimum number of bits needed to hold the type (eg: 36 for an i36), the maximum number of bits that will be overwriten when storing the type (40 bits for i36) and the ABI size (i.e. the storage size rounded up to a multiple of the alignment; 64 bits for i36). This patch removes getTypeSize (not really - it is still there but deprecated to allow for a gradual transition). Instead there is: (1) getTypeSizeInBits - a number of bits that suffices to hold all values of the type. For a primitive type, this is the minimum number of bits. For an i36 this is 36 bits. For x86 long double it is 80. This corresponds to gcc's TYPE_PRECISION. (2) getTypeStoreSizeInBits - the maximum number of bits that is written when storing the type (or read when reading it). For an i36 this is 40 bits, for an x86 long double it is 80 bits. This is the size alias analysis is interested in (getTypeStoreSize returns the number of bytes). There doesn't seem to be anything corresponding to this in gcc. (3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded up to a multiple of the alignment. For an i36 this is 64, for an x86 long double this is 96 or 128 depending on the OS. This is the spacing between consecutive elements when you form an array out of this type (getABITypeSize returns the number of bytes). This is TYPE_SIZE in gcc. Since successive elements in a SequentialType (arrays, pointers and vectors) need to be aligned, the spacing between them will be given by getABITypeSize. This means that the size of an array is the length times the getABITypeSize. It also means that GEP computations need to use getABITypeSize when computing offsets. Furthermore, if an alloca allocates several elements at once then these too need to be aligned, so the size of the alloca has to be the number of elements multiplied by getABITypeSize. Logically speaking this doesn't have to be the case when allocating just one element, but it is simpler to also use getABITypeSize in this case. So alloca's and mallocs should use getABITypeSize. Finally, since gcc's only notion of size is that given by getABITypeSize, if you want to output assembler etc the same as gcc then getABITypeSize is the size you want. Since a store will overwrite no more than getTypeStoreSize bytes, and a read will read no more than that many bytes, this is the notion of size appropriate for alias analysis calculations. In this patch I have corrected all type size uses except some of those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard cases). I will get around to auditing these too at some point, but I could do with some help. Finally, I made one change which I think wise but others might consider pointless and suboptimal: in an unpacked struct the amount of space allocated for a field is now given by the ABI size rather than getTypeStoreSize. I did this because every other place that reserves memory for a type (eg: alloca) now uses getABITypeSize, and I didn't want to make an exception for unpacked structs, i.e. I did it to make things more uniform. This only effects structs containing long doubles and arbitrary precision integers. If someone wants to pack these types more tightly they can always use a packed struct. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43620 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix test/Transforms/DeadStoreElimination/PartialStore.ll, which had beenOwen Anderson2007-11-011-4/+12
| | | | | | | silently failing because of an incorrect run line for some time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43605 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix InstCombine/2007-10-31-RangeCrash.llChris Lattner2007-11-011-0/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43596 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo in a comment.Dan Gohman2007-10-311-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43553 91177308-0d34-0410-b5e6-96231b3b80d8
* At end of LSR, replace uses of now constant (as result of SplitCriticalEdge) ↵Evan Cheng2007-10-301-9/+33
| | | | | | PHI node with the constant value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43533 91177308-0d34-0410-b5e6-96231b3b80d8
* It's not safe to tell SplitCriticalEdge to merge identical edges. It may ↵Evan Cheng2007-10-301-11/+9
| | | | | | delete the phi instruction that's being processed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43524 91177308-0d34-0410-b5e6-96231b3b80d8
* - Bug fixes.Evan Cheng2007-10-291-10/+38
| | | | | | | - Allow icmp rewrite using an iv / stride of a smaller integer type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43480 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't bitcast from pointer-to-vector to pointer-to-array whenDan Gohman2007-10-291-20/+4
| | | | | | | lowering load and store instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43468 91177308-0d34-0410-b5e6-96231b3b80d8
* Use an array instead of a fixed-length std::vector.Dan Gohman2007-10-291-6/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43467 91177308-0d34-0410-b5e6-96231b3b80d8
* Do a real assert if there is an unhandled vector instruction insteadDan Gohman2007-10-291-3/+3
| | | | | | | of just printing to cerr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43466 91177308-0d34-0410-b5e6-96231b3b80d8
* Update a comment to reflect the current code.Dan Gohman2007-10-291-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43463 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove an unused function argument.Dan Gohman2007-10-291-6/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43462 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo in a comment.Dan Gohman2007-10-291-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43461 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid calling ValidStride when not all uses are addresses.Dan Gohman2007-10-291-6/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43460 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR1752 and LoopSimplify/2007-10-28-InvokeCrash.ll: terminators Chris Lattner2007-10-291-4/+6
| | | | | | | can have uses too. Wouldn't it be nice if invoke didn't exist? :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43426 91177308-0d34-0410-b5e6-96231b3b80d8
* A number of LSR fixes:Evan Cheng2007-10-261-21/+32
| | | | | | | | | | - ChangeCompareStride only reuse stride that is larger than current stride. It will let the general reuse mechanism to try to reuse a smaller stride. - Watch out for multiplication overflow in ChangeCompareStride. - Replace std::set with SmallPtrSet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43408 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a crash. Make sure TLI is not null.Evan Cheng2007-10-261-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43384 91177308-0d34-0410-b5e6-96231b3b80d8
* More fleshing out of docs/Passes.html, plus some typo fixes andGordon Henriksen2007-10-262-9/+9
| | | | | | improved wording in source files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43377 91177308-0d34-0410-b5e6-96231b3b80d8
* Loosen up iv reuse to allow reuse of the same stride but a larger type when ↵Evan Cheng2007-10-261-17/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | truncating from the larger type to smaller type is free. e.g. Turns this loop: LBB1_1: # entry.bb_crit_edge xorl %ecx, %ecx xorw %dx, %dx movw %dx, %si LBB1_2: # bb movl L_X$non_lazy_ptr, %edi movw %si, (%edi) movl L_Y$non_lazy_ptr, %edi movw %dx, (%edi) addw $4, %dx incw %si incl %ecx cmpl %eax, %ecx jne LBB1_2 # bb into LBB1_1: # entry.bb_crit_edge xorl %ecx, %ecx xorw %dx, %dx LBB1_2: # bb movl L_X$non_lazy_ptr, %esi movw %cx, (%esi) movl L_Y$non_lazy_ptr, %esi movw %dx, (%esi) addw $4, %dx incl %ecx cmpl %eax, %ecx jne LBB1_2 # bb git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43375 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not rewrite compare instruction using iv of a different stride if the newEvan Cheng2007-10-251-36/+80
| | | | | | | stride may be rewritten using the stride of the compare instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43367 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove code that's commented out.Evan Cheng2007-10-251-2/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43356 91177308-0d34-0410-b5e6-96231b3b80d8
* If a loop termination compare instruction is the only use of its stride,Evan Cheng2007-10-251-34/+163
| | | | | | | | | | | | | | | | | | | | and the compaison is against a constant value, try eliminate the stride by moving the compare instruction to another stride and change its constant operand accordingly. e.g. loop: ... v1 = v1 + 3 v2 = v2 + 1 if (v2 < 10) goto loop => loop: ... v1 = v1 + 3 if (v1 < 30) goto loop git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43336 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix off by 1 bug in printf->puts lowering.Dale Johannesen2007-10-241-1/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43309 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify some code by using the new isNaN predicateChris Lattner2007-10-241-4/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43305 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement a couple of foldings for ordered and unordered comparisons,Chris Lattner2007-10-241-4/+44
| | | | | | | implementing cases related to PR1738. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43289 91177308-0d34-0410-b5e6-96231b3b80d8
* Strength reduction improvements.Dan Gohman2007-10-221-20/+61
| | | | | | | | | | | | | | | | | | | | | | | - Avoid attempting stride-reuse in the case that there are users that aren't addresses. In that case, there will be places where the multiplications won't be folded away, so it's better to try to strength-reduce them. - Several SSE intrinsics have operands that strength-reduction can treat as addresses. The previous item makes this more visible, as any non-address use of an IV can inhibit stride-reuse. - Make ValidStride aware of whether there's likely to be a base register in the address computation. This prevents it from thinking that things like stride 9 are valid on x86 when the base register is already occupied. Also, XFAIL the 2007-08-10-LEA16Use32.ll test; the new logic to avoid stride-reuse elimintes the LEA in the loop, so the test is no longer testing what it was intended to test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43231 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the SCEV object factors from being static members of the individualDan Gohman2007-10-222-77/+83
| | | | | | | | SCEV subclasses to being non-static member functions of the ScalarEvolution class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43224 91177308-0d34-0410-b5e6-96231b3b80d8
* Reg2Mem cleanup and optimizations:Anton Korobeynikov2007-10-212-25/+72
| | | | | | | | - enable phi instructions demotion to stack - create alloca instructions in the entry block git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43208 91177308-0d34-0410-b5e6-96231b3b80d8
* Try again.Devang Patel2007-10-181-3/+36
| | | | | | | | Instead of loading small global string from memory, use integer constant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43148 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow GVN to eliminate redundant calls to functions without side effects.Owen Anderson2007-10-181-5/+65
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43147 91177308-0d34-0410-b5e6-96231b3b80d8