aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar
Commit message (Collapse)AuthorAgeFilesLines
* Make DSE only scan blocks that are reachable from the entryChris Lattner2010-02-111-1/+7
| | | | | | | | | | block. Other blocks may have pointer cycles that will crash basicaa and other alias analyses. In any case, there is no point wasting cycles optimizing dead blocks. This fixes rdar://7635088 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95852 91177308-0d34-0410-b5e6-96231b3b80d8
* Make jump threading honor x|undef -> true and x&undef -> false,Chris Lattner2010-02-111-3/+8
| | | | | | | instead of considering x|undef -> x, which may not be true. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95850 91177308-0d34-0410-b5e6-96231b3b80d8
* Ignore dbg info intrinsics.Devang Patel2010-02-111-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95828 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix "the the" and similar typos.Dan Gohman2010-02-103-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95781 91177308-0d34-0410-b5e6-96231b3b80d8
* Pull these back out, they're a little too aggressive and timeEric Christopher2010-02-092-115/+0
| | | | | | | consuming for a simple optimization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95671 91177308-0d34-0410-b5e6-96231b3b80d8
* Add file in here too.Eric Christopher2010-02-091-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95641 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new pass to do llvm.objsize lowering using SCEV.Eric Christopher2010-02-091-0/+114
| | | | | | | | | | | | | Initial skeleton and SCEVUnknown lowering implemented, the rest should come relatively quickly. Move testcase to new directory. Move pass to right before SimplifyLibCalls - which is moved down a bit so we can take advantage of a few opts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95628 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't unroll loops containing function calls.Jakob Stoklund Olesen2010-02-051-2/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95454 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach SimplifyCFG about magic pointer constants.Jakob Stoklund Olesen2010-02-051-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Weird code sometimes uses pointer constants other than null. This patch teaches SimplifyCFG to build switch instructions in those cases. Code like this: void f(const char *x) { if (!x) puts("null"); else if ((uintptr_t)x == 1) puts("one"); else if (x == (char*)2 || x == (char*)3) puts("two"); else if ((intptr_t)x == 4) puts("four"); else puts(x); } Now becomes a switch: define void @f(i8* %x) nounwind ssp { entry: %magicptr23 = ptrtoint i8* %x to i64 ; <i64> [#uses=1] switch i64 %magicptr23, label %if.else16 [ i64 0, label %if.then i64 1, label %if.then2 i64 2, label %if.then9 i64 3, label %if.then9 i64 4, label %if.then14 ] Note that LLVM's own DenseMap uses magic pointers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95439 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement releaseMemory in CodeGenPrepare and free the BackEdgesDan Gohman2010-02-051-0/+4
| | | | | | | | container data. This prevents it from holding onto dangling pointers and potentially behaving unpredictably. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95409 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not reassociate expressions with i1 type. SimplifyCFG converts someBob Wilson2010-02-041-0/+9
| | | | | | | | | | | short-circuited conditions to AND/OR expressions, and those expressions are often converted back to a short-circuited form in code gen. The original source order may have been optimized to take advantage of the expected values, and if we reassociate them, we change the order and subvert that optimization. Radar 7497329. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95333 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95224 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 94937 and move the noreturn check to codegen.Evan Cheng2010-02-031-5/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95198 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some comment typos.Bob Wilson2010-02-031-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95170 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit this, looks like it wasn't the cause.Eric Christopher2010-02-031-2/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95165 91177308-0d34-0410-b5e6-96231b3b80d8
* Hopefully temporarily revert this.Eric Christopher2010-02-021-7/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95154 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-add strcmp and known size object size checking optimization.Eric Christopher2010-02-021-2/+7
| | | | | | | Passed bootstrap and nightly test run here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95145 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a crash in loop unswitch on a loop invariant vector condition.Chris Lattner2010-02-021-1/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95055 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95040 91177308-0d34-0410-b5e6-96231b3b80d8
* More indentation/tabification fixes.Eric Christopher2010-02-021-13/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95036 91177308-0d34-0410-b5e6-96231b3b80d8
* Untabify previous commit.Eric Christopher2010-02-021-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95035 91177308-0d34-0410-b5e6-96231b3b80d8
* Formatting.Eric Christopher2010-02-011-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95027 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95007 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94937 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94875 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert my last couple of patches. They appear to have broken bison.Eric Christopher2010-01-291-7/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94841 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94829 91177308-0d34-0410-b5e6-96231b3b80d8
* Make strcpy_chk lower to strcpy if we have a safe size.Eric Christopher2010-01-291-5/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94783 91177308-0d34-0410-b5e6-96231b3b80d8
* Generic reformatting and comment fixing. No functionality change.Bill Wendling2010-01-291-19/+20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94771 91177308-0d34-0410-b5e6-96231b3b80d8
* Add newline to debugging output, and fix some grammar-os in comment.Bill Wendling2010-01-291-5/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94765 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the less expensive getName function instead of getNameStr.Benjamin Kramer2010-01-271-5/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94683 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94451 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94433 91177308-0d34-0410-b5e6-96231b3b80d8
* make -fno-rtti the default unless a directory builds with REQUIRES_RTTI.Chris Lattner2010-01-241-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94378 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94323 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94321 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a crash in jump threading, PR6119Chris Lattner2010-01-231-0/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94319 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply 94059 while fixing the calling convention setupEric Christopher2010-01-231-0/+47
| | | | | | | for strcpy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94287 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 94059. It is breaking the MultiSource/Benchmarks/Prolangs-C/bisonBob Wilson2010-01-221-45/+0
| | | | | | | test on ARM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94198 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94164 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert LoopStrengthReduce.cpp to pre-r94061 for now.Dan Gohman2010-01-221-2355/+2268
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94123 91177308-0d34-0410-b5e6-96231b3b80d8
* 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() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94111 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94110 91177308-0d34-0410-b5e6-96231b3b80d8
* Include IVUsers information in LSR's debug output.Dan Gohman2010-01-211-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94108 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94107 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a comment.Dan Gohman2010-01-211-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94104 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94061 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94059 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93935 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93848 91177308-0d34-0410-b5e6-96231b3b80d8