summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
Commit message (Collapse)AuthorAgeFilesLines
* Adjust the heuristics used to decide when SROA is likely to be profitable.Bob Wilson2010-02-031-18/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SRThreshold value makes perfect sense for checking if an entire aggregate should be promoted to a scalar integer, but it is not so good for splitting an aggregate into its separate elements. A struct may contain a large embedded array along with some scalar fields that would benefit from being split apart by SROA. Even if the total aggregate size is large, it may still be good to perform SROA. Thus, the most important piece of this patch is simply moving the aggregate size comparison vs. SRThreshold so that it guards only the aggregate promotion. We have also been checking the number of elements to decide if an aggregate should be split up. The limit of "SRThreshold/4" seemed rather arbitrary, and I don't think it's very useful to derive this limit from SRThreshold anyway. I've collected some data showing that the current default limit of 32 (since SRThreshold defaults to 128) is a reasonable cutoff for struct types. One thing suggested by the data is that distinguishing between structs and arrays might be useful. There are (obviously) a lot more large arrays than large structs (as measured by the number of elements and not the total size -- a large array inside a struct still counts as a single element given the way we do SROA right now). Out of 8377 arrays where we successfully performed SROA while compiling a large set of benchmarks, only 16 of them had more than 8 elements. And, for those 16 arrays, it's not at all clear that SROA was actually beneficial. So, to offset the compile time cost of investigating more large structs for SROA, the patch lowers the limit on array elements to 8. This fixes Apple Radar 7563690. llvm-svn: 95224
* Revert 94937 and move the noreturn check to codegen.Evan Cheng2010-02-031-5/+4
| | | | llvm-svn: 95198
* Fix some comment typos.Bob Wilson2010-02-031-3/+3
| | | | llvm-svn: 95170
* Recommit this, looks like it wasn't the cause.Eric Christopher2010-02-031-2/+7
| | | | llvm-svn: 95165
* Hopefully temporarily revert this.Eric Christopher2010-02-021-7/+2
| | | | llvm-svn: 95154
* Re-add strcmp and known size object size checking optimization.Eric Christopher2010-02-021-2/+7
| | | | | | Passed bootstrap and nightly test run here. llvm-svn: 95145
* fix a crash in loop unswitch on a loop invariant vector condition.Chris Lattner2010-02-021-1/+5
| | | | llvm-svn: 95055
* Don't need to check the last argument since it'll always be bool. We alsoEric Christopher2010-02-021-5/+1
| | | | | | don't use TargetData here. llvm-svn: 95040
* More indentation/tabification fixes.Eric Christopher2010-02-021-13/+13
| | | | llvm-svn: 95036
* Untabify previous commit.Eric Christopher2010-02-021-3/+3
| | | | llvm-svn: 95035
* Formatting.Eric Christopher2010-02-011-3/+3
| | | | llvm-svn: 95027
* Add an option to GVN to remove all partially redundant loads. This is currentlyBob Wilson2010-02-011-80/+107
| | | | | | | | | disabled by default. This divides the existing load PRE code into 2 phases: first it checks that it is safe to move the load to each of the predecessors where it is unavailable, and then if it is safe, the code is changed to move the load. Radar 7571861. llvm-svn: 95007
* Do not mark no-return calls tail calls. It'll screw up special calls like ↵Evan Cheng2010-01-311-4/+5
| | | | | | longjmp and it doesn't make much sense for performance reason. If my logic is faulty, please let me know. llvm-svn: 94937
* Check alignment of loads when deciding whether it is safe to execute themBob Wilson2010-01-302-2/+4
| | | | | | | unconditionally. Besides checking the offset, also check that the underlying object is aligned as much as the load itself. llvm-svn: 94875
* Revert my last couple of patches. They appear to have broken bison.Eric Christopher2010-01-291-7/+5
| | | | llvm-svn: 94841
* Improve isSafeToLoadUnconditionally to recognize that GEPs with constantBob Wilson2010-01-291-1/+2
| | | | | | | indices are safe if the result is known to be within the bounds of the underlying object. llvm-svn: 94829
* Make strcpy_chk lower to strcpy if we have a safe size.Eric Christopher2010-01-291-5/+7
| | | | llvm-svn: 94783
* Generic reformatting and comment fixing. No functionality change.Bill Wendling2010-01-291-19/+20
| | | | llvm-svn: 94771
* Add newline to debugging output, and fix some grammar-os in comment.Bill Wendling2010-01-291-5/+5
| | | | llvm-svn: 94765
* Use the less expensive getName function instead of getNameStr.Benjamin Kramer2010-01-271-5/+4
| | | | llvm-svn: 94683
* Remove check for an impossible condition: the condition of the while loop hasBob Wilson2010-01-251-2/+0
| | | | | | already checked that TmpBB->getSinglePredecessor() is non-null. llvm-svn: 94451
* Change Value::getUnderlyingObject to have the MaxLookup value specified as aBob Wilson2010-01-251-3/+3
| | | | | | | | | | | | parameter with a default value, instead of just hardcoding it in the implementation. The limit of MaxLookup = 6 was introduced in r69151 to fix a performance problem with O(n^2) behavior in instcombine, but the scalarrepl pass is relying on getUnderlyingObject to go all the way back to an AllocaInst. Making the limit part of the method signature makes it clear that by default the result is limited and should help avoid similar problems in the future. This fixes pr6126. llvm-svn: 94433
* make -fno-rtti the default unless a directory builds with REQUIRES_RTTI.Chris Lattner2010-01-241-1/+0
| | | | llvm-svn: 94378
* third bug from PR6119: the xor dupe extension allowsChris Lattner2010-01-231-2/+2
| | | | | | | | for arbitrary terminators in predecessors, don't assume it is a conditional or uncond branch. The testcase shows an example where they can happen with switches. llvm-svn: 94323
* add an early out to ProcessBranchOnXOR to speed it up,Chris Lattner2010-01-231-0/+25
| | | | | | | | handle the case when we can infer an input to the xor from all inputs that agree, instead of going into an infinite loop. Another part of PR6199 llvm-svn: 94321
* fix a crash in jump threading, PR6119Chris Lattner2010-01-231-0/+6
| | | | llvm-svn: 94319
* Reapply 94059 while fixing the calling convention setupEric Christopher2010-01-231-0/+47
| | | | | | for strcpy. llvm-svn: 94287
* Revert 94059. It is breaking the MultiSource/Benchmarks/Prolangs-C/bisonBob Wilson2010-01-221-45/+0
| | | | | | test on ARM. llvm-svn: 94198
* Stop building RTTI information for *most* llvm libraries. NotableChris Lattner2010-01-221-0/+1
| | | | | | | | | | | missing ones are libsupport, libsystem and libvmcore. libvmcore is currently blocked on bugpoint, which uses EH. Once it stops using EH, we can switch it off. This #if 0's out 3 unit tests, because gtest requires RTTI information. Suggestions welcome on how to fix this. llvm-svn: 94164
* Revert LoopStrengthReduce.cpp to pre-r94061 for now.Dan Gohman2010-01-221-2355/+2268
| | | | llvm-svn: 94123
* DbgInfoIntrinsics no longer appear in an instruction's use list; so clean up ↵Victor Hernandez2010-01-211-59/+7
| | | | | | looking for them in use iterations and remove OnlyUsedByDbgInfoIntrinsics() llvm-svn: 94111
* When inserting expressions for post-increment users which containDan Gohman2010-01-211-17/+32
| | | | | | | | loop-variant components, adds must be inserted after the increment. Keep track of the increment position for this case, and insert these adds in the correct location. llvm-svn: 94110
* Include IVUsers information in LSR's debug output.Dan Gohman2010-01-211-1/+1
| | | | llvm-svn: 94108
* Prune the search for candidate formulae if the number of registerDan Gohman2010-01-211-32/+67
| | | | | | | operands exceeds the number of registers used in the initial solution, as that wouldn't lead to a profitable solution anyway. llvm-svn: 94107
* Add a comment.Dan Gohman2010-01-211-1/+2
| | | | llvm-svn: 94104
* Re-implement the main strength-reduction portion of LoopStrengthReduction.Dan Gohman2010-01-212-2273/+2315
| | | | | | | | | | | | | | This new version is much more aggressive about doing "full" reduction in cases where it reduces register pressure, and also more aggressive about rewriting induction variables to count down (or up) to zero when doing so reduces register pressure. It currently uses fairly simplistic algorithms for finding reuse opportunities, but it introduces a new framework allows it to combine multiple strategies at once to form hybrid solutions, instead of doing all full-reduction or all base+index. llvm-svn: 94061
* Add strcpy_chk -> strcpy support for "don't know" object sizeEric Christopher2010-01-211-0/+45
| | | | | | answers. This will update as object size checking gets better information. llvm-svn: 94059
* When doing address-mode sinking, expand the base register first, ratherDan Gohman2010-01-191-12/+17
| | | | | | | | | | | | than the scaled register. This makes it more likely that subsequent AddrModeMatcher queries will match the new address the same way as the old, instead of accidentally matching what had been the base register as the new scaled register, and then failing to match the scaled register. This fixes some problems with address-mode sinking multiple muls into a block, which will be a lot more common with some upcoming LoopStrengthReduction changes. llvm-svn: 93935
* Fix a crash in scalarrepl for memcpy/memmove where the source and destinationBob Wilson2010-01-191-6/+10
| | | | | | | | | are the same. I had already fixed a similar problem where the source and destination were different bitcasts derived from the same alloca, but the previous fix still did not handle the case where both operands are exactly the same value. Radar 7552893. llvm-svn: 93848
* Convert some of the dynamic opcode lookups into static ones.Owen Anderson2010-01-171-59/+40
| | | | llvm-svn: 93693
* 1) Use the new SimplifyInstructionsInBlock routine instead of the copyChris Lattner2010-01-121-17/+14
| | | | | | | | | | | | in JT. 2) When cloning blocks for PHI or xor conditions, use instsimplify to simplify the code as we go. This allows us to squish common cases early in JT which opens up opportunities for subsequent iterations, and allows it to completely simplify the testcase. llvm-svn: 93253
* tidy upChris Lattner2010-01-121-5/+1
| | | | llvm-svn: 93222
* Teach jump threading to duplicate small blocks when the branchChris Lattner2010-01-121-9/+123
| | | | | | | | | | | | | | | | | | | condition is a xor with a phi node. This eliminates nonsense like this from 176.gcc in several places: LBB166_84: testl %eax, %eax - setne %al - xorb %cl, %al - notb %al - testb $1, %al - je LBB166_85 + je LBB166_69 + jmp LBB166_85 This is rdar://7391699 llvm-svn: 93221
* some cleanup, and make it obvious that ProcessJumpOnPHI only worksChris Lattner2010-01-111-24/+14
| | | | | | on branches by renaming it and checking for a branch at the call site. llvm-svn: 93208
* only factor from expressions whose uses are empty and whoseChris Lattner2010-01-091-0/+5
| | | | | | base is the right expression type. This fixes PR5981. llvm-svn: 93045
* Suppress an unused variable warning when assertions are off;Duncan Sands2010-01-081-2/+3
| | | | | | remove some trailing whitespace while there. llvm-svn: 93008
* Use a do-while loop instead of while + boolean.Benjamin Kramer2010-01-071-6/+4
| | | | llvm-svn: 92912
* Move the object size intrinsic optimization to inst-combine and makeEric Christopher2010-01-061-24/+0
| | | | | | it work for any integer size return type. llvm-svn: 92853
* Formatting.Mikhail Glushenkov2010-01-061-2/+2
| | | | llvm-svn: 92831
* Move remaining stuff to the isInteger predicate.Benjamin Kramer2010-01-051-12/+9
| | | | llvm-svn: 92771
OpenPOWER on IntegriCloud