summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/JumpThreading
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix an infinite alternation in JumpThreading where two transforms would ↵Owen Anderson2011-04-141-0/+31
| | | | | | | | | | 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. llvm-svn: 129538
* PR9446: RecursivelyDeleteTriviallyDeadInstructions can delete the instructionEli Friedman2011-04-021-0/+32
| | | | | | | | | | | 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. llvm-svn: 128782
* Fix PR9331. Simplified version of a patch by Jakub Staszak.Duncan Sands2011-03-081-0/+50
| | | | llvm-svn: 127243
* prevent jump threading from merging blocks when their address isChris Lattner2011-02-181-1/+34
| | | | | | | | | | | | | | | | | 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. llvm-svn: 125829
* Tolerate degenerate phi nodes that can occur in the middle of optimizationNick Lewycky2011-02-101-0/+24
| | | | | | passes. Fixes PR9112. Patch by Jakub Staszak! llvm-svn: 125319
* Re-apply r124518 with fix. Watch out for invalidated iterator.Evan Cheng2011-01-293-7/+21
| | | | llvm-svn: 124526
* Revert r124518. It broke Linux self-host.Evan Cheng2011-01-293-21/+7
| | | | llvm-svn: 124522
* Re-commit r124462 with fixes. Tail recursion elim will now dup ret into ↵Evan Cheng2011-01-293-7/+21
| | | | | | unconditional predecessor to enable TCE on demand. llvm-svn: 124518
* Revert r124462. There are a few big regressions that I need to fix first.Evan Cheng2011-01-283-21/+7
| | | | llvm-svn: 124478
* - Stop simplifycfg from duplicating "ret" instructions into unconditionalEvan Cheng2011-01-283-7/+21
| | | | | | | | branches. PR8575, rdar://5134905, rdar://8911460. - Allow codegen tail duplication to dup small return blocks after register allocation is done. llvm-svn: 124462
* Teach jump threading to "look through" a select when the branch direction of ↵Frits van Bommel2010-12-151-0/+123
| | | | | | | | 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. llvm-svn: 121859
* Implement jump threading of 'indirectbr' by keeping track of whether we're ↵Frits van Bommel2010-12-061-0/+61
| | | | | | looking for ConstantInt*s or BlockAddress*s. llvm-svn: 121066
* Fix PR8247: JumpThreading can cause a block to become unreachable while ↵Owen Anderson2010-09-291-0/+27
| | | | | | | | | | 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. llvm-svn: 115082
* Remove dead option from tests.Owen Anderson2010-09-143-3/+3
| | | | llvm-svn: 113855
* Merge 2010-08-31-InfiniteRecursion.ll into crash.ll.Owen Anderson2010-08-312-25/+23
| | | | llvm-svn: 112635
* Add a test for the duplicated-conditional situation illutrated by PR5652.Owen Anderson2010-08-311-0/+24
| | | | llvm-svn: 112621
* Manually reduce this testcase.Owen Anderson2010-08-311-77/+11
| | | | llvm-svn: 112615
* Add a micro-test for the transforms I added to JumpThreading.Owen Anderson2010-08-311-0/+30
| | | | | | | | | | | | 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. llvm-svn: 112611
* More Chris-inspired JumpThreading fixes: use ConstantExpr to correctly ↵Owen Anderson2010-08-311-0/+91
| | | | | | | | | 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. llvm-svn: 112589
* Use LVI to eliminate conditional branches where we've tested a related ↵Owen Anderson2010-08-272-5/+12
| | | | | | | | condition previously. Update tests for this change. This fixes PR5652. llvm-svn: 112270
* Make JumpThreading smart enough to properly thread StrSwitch when it's ↵Owen Anderson2010-08-261-0/+162
| | | | | | compiled with clang++. llvm-svn: 112198
* In the default address space, any GEP off of null results in a trap value if ↵Owen Anderson2010-08-251-0/+48
| | | | | | | | | 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. llvm-svn: 112015
* Fix PR7755: knowing something about an inval for a predChris Lattner2010-08-181-0/+24
| | | | | | | | | 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. llvm-svn: 111349
* Fix a test with malformed IR. Not sure why this didn't fail before.Owen Anderson2010-07-261-0/+3
| | | | llvm-svn: 109422
* Fix PR7647, handling the case when 'To' ends up being Chris Lattner2010-07-151-0/+47
| | | | | | | | | | 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. llvm-svn: 108415
* if jump threading is able to infer interesting values on bothChris Lattner2010-07-121-0/+24
| | | | | | | | the LHS and RHS of an and/or instruction, don't multiply add known predecessor values. This fixes the crash on testcase from PR7498 llvm-svn: 108114
* jump threading can't split a critical edge from an indirectbr. ThisChris Lattner2010-06-141-0/+22
| | | | | | fixes PR7356. llvm-svn: 105950
* fix PR6743, a case where we'd delete an instruction before using itChris Lattner2010-04-101-0/+17
| | | | | | in some cases. llvm-svn: 100937
* fix PR6305 by handling BlockAddress in a helper functionChris Lattner2010-02-151-0/+11
| | | | | | called by jump threading. llvm-svn: 96263
* Make jump threading honor x|undef -> true and x&undef -> false,Chris Lattner2010-02-111-0/+69
| | | | | | instead of considering x|undef -> x, which may not be true. llvm-svn: 95850
* third bug from PR6119: the xor dupe extension allowsChris Lattner2010-01-231-0/+27
| | | | | | | | 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/+27
| | | | | | | | 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/+25
| | | | llvm-svn: 94319
* 1) Use the new SimplifyInstructionsInBlock routine instead of the copyChris Lattner2010-01-121-6/+1
| | | | | | | | | | | | 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
* Teach jump threading to duplicate small blocks when the branchChris Lattner2010-01-121-5/+18
| | | | | | | | | | | | | | | | | | | 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
* fix PR5698Chris Lattner2009-12-061-0/+22
| | | | llvm-svn: 90708
* fix PR5640 by tracking whether a block is the header of a loop moreChris Lattner2009-12-011-0/+20
| | | | | | precisely, which prevents us from infinitely peeling the loop. llvm-svn: 90211
* typoGabor Greif2009-11-121-1/+1
| | | | llvm-svn: 86980
* use getPredicateOnEdge to fold comparisons through PHI nodes,Chris Lattner2009-11-121-0/+32
| | | | | | | which implements GCC PR18046. This also gets us 360 more jump threads on 176.gcc. llvm-svn: 86953
* should not commit when distracted.Chris Lattner2009-11-121-4/+3
| | | | llvm-svn: 86929
* We now thread some impossible condition information with LVI.Chris Lattner2009-11-121-2/+30
| | | | llvm-svn: 86927
* with the new code we can thread non-instruction values. ThisChris Lattner2009-11-121-2/+40
| | | | | | allows us to handle the test10 testcase. llvm-svn: 86924
* move some stuff into DEBUG's and turn on lazy-value-info forChris Lattner2009-11-121-1/+1
| | | | | | the basic.ll testcase. llvm-svn: 86918
* oops, didn't mean to commit this, no harm, but add a todoops, didn't mean to ↵Chris Lattner2009-11-111-0/+1
| | | | | | commit this, no harm, but add a todoo llvm-svn: 86768
* Stub out a new lazy value info pass, which will eventuallyChris Lattner2009-11-111-0/+26
| | | | | | vend value constraint information to the optimizer. llvm-svn: 86767
* implement a TODO by teaching jump threading about "xor x, 1".Chris Lattner2009-11-101-0/+39
| | | | llvm-svn: 86739
* Make jump threading eliminate blocks that just contain phi nodes,Chris Lattner2009-11-101-3/+13
| | | | | | | | debug intrinsics, and an unconditional branch when possible. This reuses the TryToSimplifyUncondBranchFromEmptyBlock function split out of simplifycfg. llvm-svn: 86722
* make jump threading recursively simplify expressions instead of doing it Chris Lattner2009-11-101-0/+32
| | | | | | | | | | | | | | | | | | | 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. llvm-svn: 86646
* reapply 86289, 86278, 86270, 86267, 86266 & 86264 plus a fixChris Lattner2009-11-072-0/+53
| | | | | | | | | (making pred factoring only happen if threading is guaranteed to be successful). This now survives an X86-64 bootstrap of llvm-gcc. llvm-svn: 86355
* Revert following patches to fix llvmgcc bootstrap.Devang Patel2009-11-072-53/+0
| | | | | | | 86289, 86278, 86270, 86267, 86266 & 86264 Chris, please take a look. llvm-svn: 86321
OpenPOWER on IntegriCloud