summaryrefslogtreecommitdiff
path: root/test/Transforms/JumpThreading
Commit message (Collapse)AuthorAge
* remove asmparser support for the old getresult instruction, which has been ↵Chris Lattner2011-06-17
| | | | | | subsumed by extractvalue. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133247 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an infinite alternation in JumpThreading where two transforms would ↵Owen Anderson2011-04-14
| | | | | | | | | | | repeatedly undo each other. The solution is to perform more aggressive constant folding to make one of the edges just folded away rather than trying to thread it. Fixes <rdar://problem/9284786>. Discovered with CSmith. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129538 91177308-0d34-0410-b5e6-96231b3b80d8
* PR9446: RecursivelyDeleteTriviallyDeadInstructions can delete the instructionEli Friedman2011-04-02
| | | | | | | | | | | | | after the given instruction; make sure to handle that case correctly. (It's difficult to trigger; the included testcase involves a dead block, but I don't think that's a requirement.) While I'm here, get rid of the unnecessary warning about SimplifyInstructionsInBlock, since it should work correctly as far as I know. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128782 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR9331. Simplified version of a patch by Jakub Staszak.Duncan Sands2011-03-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127243 91177308-0d34-0410-b5e6-96231b3b80d8
* prevent jump threading from merging blocks when their address isChris Lattner2011-02-18
| | | | | | | | | | | | | | | | | | | taken (and used!). This prevents merging the blocks (invalidating the block addresses) in a case like this: #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) void foo() { printf("%p\n", _THIS_IP_); printf("%p\n", _THIS_IP_); printf("%p\n", _THIS_IP_); } which fixes PR4151. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125829 91177308-0d34-0410-b5e6-96231b3b80d8
* Tolerate degenerate phi nodes that can occur in the middle of optimizationNick Lewycky2011-02-10
| | | | | | | passes. Fixes PR9112. Patch by Jakub Staszak! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125319 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-apply r124518 with fix. Watch out for invalidated iterator.Evan Cheng2011-01-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124526 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r124518. It broke Linux self-host.Evan Cheng2011-01-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124522 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-commit r124462 with fixes. Tail recursion elim will now dup ret into ↵Evan Cheng2011-01-29
| | | | | | unconditional predecessor to enable TCE on demand. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124518 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r124462. There are a few big regressions that I need to fix first.Evan Cheng2011-01-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124478 91177308-0d34-0410-b5e6-96231b3b80d8
* - Stop simplifycfg from duplicating "ret" instructions into unconditionalEvan Cheng2011-01-28
| | | | | | | | | branches. PR8575, rdar://5134905, rdar://8911460. - Allow codegen tail duplication to dup small return blocks after register allocation is done. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124462 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach jump threading to "look through" a select when the branch direction of ↵Frits van Bommel2010-12-15
| | | | | | | | | a terminator depends on it. When it sees a promising select it now tries to figure out whether the condition of the select is known in any of the predecessors and if so it maps the operands appropriately. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121859 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement jump threading of 'indirectbr' by keeping track of whether we're ↵Frits van Bommel2010-12-06
| | | | | | looking for ConstantInt*s or BlockAddress*s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121066 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR8247: JumpThreading can cause a block to become unreachable while ↵Owen Anderson2010-09-29
| | | | | | | | | | | still having predecessor, if it is part of a self-loop. Because of this, we cannot use the Simplify* APIs, as they can assert-fail on unreachable code. Since it's not easy to determine if a given threading will cause a block to become unreachable, simply defer simplifying simplification to later InstCombine and/or DCE passes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115082 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove dead option from tests.Owen Anderson2010-09-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113855 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge 2010-08-31-InfiniteRecursion.ll into crash.ll.Owen Anderson2010-08-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112635 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a test for the duplicated-conditional situation illutrated by PR5652.Owen Anderson2010-08-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112621 91177308-0d34-0410-b5e6-96231b3b80d8
* Manually reduce this testcase.Owen Anderson2010-08-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112615 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a micro-test for the transforms I added to JumpThreading.Owen Anderson2010-08-31
| | | | | | | | | | | | | I have not been able to find a way to test each in isolation, for a few reasons: 1) The ability to look-through non-i1 BinaryOperator's requires the ability to look through non-constant ICmps in order for it to ever trigger. 2) The ability to do LVI-powered PHI value determination only matters in cases that ProcessBranchOnPHI can't handle. Since it already handles all the cases without other instructions in the def-use chain between the PHI and the branch, it requires the ability to look through ICmps and/or BinaryOperators as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112611 91177308-0d34-0410-b5e6-96231b3b80d8
* More Chris-inspired JumpThreading fixes: use ConstantExpr to correctly ↵Owen Anderson2010-08-31
| | | | | | | | | | constant-fold undef, and be more careful with its return value. This actually exposed an infinite recursion bug in ComputeValueKnownInPredecessors which theoretically already existed (in JumpThreading's handling of and/or of i1's), but never manifested before. This patch adds a tracking set to prevent this case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112589 91177308-0d34-0410-b5e6-96231b3b80d8
* Use LVI to eliminate conditional branches where we've tested a related ↵Owen Anderson2010-08-27
| | | | | | | | | condition previously. Update tests for this change. This fixes PR5652. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112270 91177308-0d34-0410-b5e6-96231b3b80d8
* Make JumpThreading smart enough to properly thread StrSwitch when it's ↵Owen Anderson2010-08-26
| | | | | | compiled with clang++. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112198 91177308-0d34-0410-b5e6-96231b3b80d8
* In the default address space, any GEP off of null results in a trap value if ↵Owen Anderson2010-08-25
| | | | | | | | | | you try to load it. Thus, any load in the default address space that completes implies that the base value that it GEP'd from was not null. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112015 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR7755: knowing something about an inval for a predChris Lattner2010-08-18
| | | | | | | | | | from the LHS should disable reconsidering that pred on the RHS. However, knowing something about the pred on the RHS shouldn't disable subsequent additions on the RHS from happening. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111349 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a test with malformed IR. Not sure why this didn't fail before.Owen Anderson2010-07-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109422 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR7647, handling the case when 'To' ends up being Chris Lattner2010-07-15
| | | | | | | | | | | mutated by recursive simplification. This also enhances ReplaceAndSimplifyAllUses to actually do a real RAUW at the end of it, which updates any value handles pointing to "From" to start pointing to "To". This seems useful for debug info and random other VH users. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108415 91177308-0d34-0410-b5e6-96231b3b80d8
* if jump threading is able to infer interesting values on bothChris Lattner2010-07-12
| | | | | | | | | the LHS and RHS of an and/or instruction, don't multiply add known predecessor values. This fixes the crash on testcase from PR7498 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108114 91177308-0d34-0410-b5e6-96231b3b80d8
* jump threading can't split a critical edge from an indirectbr. ThisChris Lattner2010-06-14
| | | | | | | fixes PR7356. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105950 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR6743, a case where we'd delete an instruction before using itChris Lattner2010-04-10
| | | | | | | in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100937 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR6305 by handling BlockAddress in a helper functionChris Lattner2010-02-15
| | | | | | | called by jump threading. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96263 91177308-0d34-0410-b5e6-96231b3b80d8
* Make jump threading honor x|undef -> true and x&undef -> false,Chris Lattner2010-02-11
| | | | | | | 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
* third bug from PR6119: the xor dupe extension allowsChris Lattner2010-01-23
| | | | | | | | | 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-23
| | | | | | | | | 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-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94319 91177308-0d34-0410-b5e6-96231b3b80d8
* 1) Use the new SimplifyInstructionsInBlock routine instead of the copyChris Lattner2010-01-12
| | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93253 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach jump threading to duplicate small blocks when the branchChris Lattner2010-01-12
| | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93221 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR5698Chris Lattner2009-12-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90708 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR5640 by tracking whether a block is the header of a loop moreChris Lattner2009-12-01
| | | | | | | precisely, which prevents us from infinitely peeling the loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90211 91177308-0d34-0410-b5e6-96231b3b80d8
* typoGabor Greif2009-11-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86980 91177308-0d34-0410-b5e6-96231b3b80d8
* use getPredicateOnEdge to fold comparisons through PHI nodes,Chris Lattner2009-11-12
| | | | | | | | which implements GCC PR18046. This also gets us 360 more jump threads on 176.gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86953 91177308-0d34-0410-b5e6-96231b3b80d8
* should not commit when distracted.Chris Lattner2009-11-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86929 91177308-0d34-0410-b5e6-96231b3b80d8
* We now thread some impossible condition information with LVI.Chris Lattner2009-11-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86927 91177308-0d34-0410-b5e6-96231b3b80d8
* with the new code we can thread non-instruction values. ThisChris Lattner2009-11-12
| | | | | | | allows us to handle the test10 testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86924 91177308-0d34-0410-b5e6-96231b3b80d8
* move some stuff into DEBUG's and turn on lazy-value-info forChris Lattner2009-11-12
| | | | | | | the basic.ll testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86918 91177308-0d34-0410-b5e6-96231b3b80d8
* oops, didn't mean to commit this, no harm, but add a todoops, didn't mean to ↵Chris Lattner2009-11-11
| | | | | | commit this, no harm, but add a todoo git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86768 91177308-0d34-0410-b5e6-96231b3b80d8
* Stub out a new lazy value info pass, which will eventuallyChris Lattner2009-11-11
| | | | | | | vend value constraint information to the optimizer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86767 91177308-0d34-0410-b5e6-96231b3b80d8
* implement a TODO by teaching jump threading about "xor x, 1".Chris Lattner2009-11-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86739 91177308-0d34-0410-b5e6-96231b3b80d8
* Make jump threading eliminate blocks that just contain phi nodes,Chris Lattner2009-11-10
| | | | | | | | | debug intrinsics, and an unconditional branch when possible. This reuses the TryToSimplifyUncondBranchFromEmptyBlock function split out of simplifycfg. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86722 91177308-0d34-0410-b5e6-96231b3b80d8
* make jump threading recursively simplify expressions instead of doing it Chris Lattner2009-11-10
| | | | | | | | | | | | | | | | | | | | | just one level deep. On the testcase we go from getting this: F1: ; preds = %T2 %F = and i1 true, %cond ; <i1> [#uses=1] br i1 %F, label %X, label %Y to a fully threaded: F1: ; preds = %T2 br label %Y This changes gets us to the point where we're forming (too many) switch instructions on doug's strswitch testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86646 91177308-0d34-0410-b5e6-96231b3b80d8
* reapply 86289, 86278, 86270, 86267, 86266 & 86264 plus a fixChris Lattner2009-11-07
| | | | | | | | | | | (making pred factoring only happen if threading is guaranteed to be successful). This now survives an X86-64 bootstrap of llvm-gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86355 91177308-0d34-0410-b5e6-96231b3b80d8