aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/SimplifyCFG
Commit message (Collapse)AuthorAgeFilesLines
* Change these tests to feed the assembly files to opt directly, insteadDan Gohman2009-09-0877-78/+78
| | | | | | | of using llvm-as, now that opt supports this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81226 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply 79977.Devang Patel2009-08-281-2/+0
| | | | | | | Use MDNodes to encode debug info in llvm IR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80406 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 79977. It causes llvm-gcc bootstrap failures on some platforms.Devang Patel2009-08-261-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80073 91177308-0d34-0410-b5e6-96231b3b80d8
* Update DebugInfo interface to use metadata, instead of special named ↵Devang Patel2009-08-251-2/+0
| | | | | | | | | llvm.dbg.... global variables, to encode debugging information in llvm IR. This is mostly a mechanical change that tests metadata support very well. This change speeds up llvm-gcc by more then 6% at "-O0 -g" (measured by compiling InstructionCombining.cpp!) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79977 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix for PR3016: detect the tricky case, where there are Eli Friedman2009-08-161-1/+0
| | | | | | | | | | | | | | | | | | unfoldable references to a PHI node in the block being folded, and disable the transformation in that case. The correct transformation of such PHI nodes depends on whether BB dominates Succ, and dominance is expensive to compute here. (Alternatively, it's possible to check whether any uses are live, but that's also essentially a dominance calculation. Another alternative is to use reg2mem, but it probably isn't a good idea to use that in simplifycfg.) Also, remove some incorrect code from CanPropagatePredecessorsForPHIs which is made unnecessary with this patch: it didn't consider the case where a PHI node in BB has multiple uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79174 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 75571; I'm convinced this isn't the right thing to do.Dale Johannesen2009-07-141-11/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75642 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't delete asm's just because their inputs are undefined;Dale Johannesen2009-07-141-0/+11
| | | | | | | | xor R, R is a common and valid idiom for zeroing a register, for example. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75571 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the crash in this test. This is basically the sameDale Johannesen2009-06-151-0/+557
| | | | | | | | | | problem addressed in 31284, but the patch there only addressed the case where an invoke is the first thing in a block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73416 91177308-0d34-0410-b5e6-96231b3b80d8
* Split the Add, Sub, and Mul instruction opcodes into separateDan Gohman2009-06-044-10/+10
| | | | | | | | | | | | | | | | integer and floating-point opcodes, introducing FAdd, FSub, and FMul. For now, the AsmParser, BitcodeReader, and IRBuilder all preserve backwards compatability, and the Core LLVM APIs preserve backwards compatibility for IR producers. Most front-ends won't need to change immediately. This implements the first step of the plan outlined here: http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72897 91177308-0d34-0410-b5e6-96231b3b80d8
* Testcase for 71688.Dale Johannesen2009-05-131-0/+47
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71691 91177308-0d34-0410-b5e6-96231b3b80d8
* While hoisting instruction to speculatively execute simple bb, ignore dbg ↵Devang Patel2009-03-061-0/+108
| | | | | | intrinsics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66255 91177308-0d34-0410-b5e6-96231b3b80d8
* Ignore dbg info intrinsics when folding conditional branch to Zhou Sheng2009-02-261-0/+70
| | | | | | | conditional branch predecessors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65509 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't block basic block with only SwitchInst to fold into predecessors.Zhou Sheng2009-02-251-0/+116
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65456 91177308-0d34-0410-b5e6-96231b3b80d8
* While folding unconditional return move DbgRegionEndInst into the ↵Devang Patel2009-02-241-2/+4
| | | | | | | | | | | | | predecessor, instead of removing it. This fixes following tests from llvmgcc42 testsuite. gcc.c-torture/execute/20000605-3.c gcc.c-torture/execute/20020619-1.c gcc.c-torture/execute/20030920-1.c gcc.c-torture/execute/loop-ivopts-1.c git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65353 91177308-0d34-0410-b5e6-96231b3b80d8
* If llvm.dbg.region.end is disappearing then remove corresponding ↵Devang Patel2009-02-111-0/+1
| | | | | | llvm.dbg.func.start also. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64278 91177308-0d34-0410-b5e6-96231b3b80d8
* Ignore dbg intrinsic while folding unconditional branch.Devang Patel2009-02-101-0/+70
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64242 91177308-0d34-0410-b5e6-96231b3b80d8
* Ignore dbg intrinsics while folding switch instruction.Devang Patel2009-02-051-0/+58
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63802 91177308-0d34-0410-b5e6-96231b3b80d8
* Ignore dbg intrinsics.Devang Patel2009-02-041-0/+122
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63781 91177308-0d34-0410-b5e6-96231b3b80d8
* While folding vallue comparison terminators ignore dbg intrinsics.Devang Patel2009-02-041-0/+49
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63700 91177308-0d34-0410-b5e6-96231b3b80d8
* Ignore dbg intrinsics while hoisting common code in the two blocks up into ↵Devang Patel2009-02-041-0/+33
| | | | | | the branch block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63687 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not let dbg intrinsic block folding of two entry phi node.Devang Patel2009-02-031-0/+28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63671 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a testcase.Chris Lattner2009-01-221-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62758 91177308-0d34-0410-b5e6-96231b3b80d8
* Temporarily XFAIL until this can be looked at. r62557 is what caused it to ↵Bill Wendling2009-01-201-0/+1
| | | | | | start failing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62578 91177308-0d34-0410-b5e6-96231b3b80d8
* another fix for PR3354Chris Lattner2009-01-201-1/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62561 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a problem exposed by PR3354: simplifycfg was making a potentiallyChris Lattner2009-01-191-0/+20
| | | | | | | trapping instruction be executed unconditionally. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62541 91177308-0d34-0410-b5e6-96231b3b80d8
* convert this to an unfoldable potentially trapping constant expr.Chris Lattner2009-01-191-2/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62536 91177308-0d34-0410-b5e6-96231b3b80d8
* Temporarily revert r62487. It's causing this error during a release bootstrap ofBill Wendling2009-01-191-0/+1
| | | | | | | | | | | | | | | | | | llvm-gcc. Most likely, it's miscompiling one of the "gen*" programs: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./prev-gcc/xgcc -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./prev-gcc/ -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.6.0/bin/ -c -g -O2 -mdynamic-no-pic -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -mdynamic-no-pic -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../llvm-gcc.src/gcc -I../../llvm-gcc.src/gcc/build -I../../llvm-gcc.src/gcc/../include -I./../intl -I../../llvm-gcc.src/gcc/../libcpp/include -I../../llvm-gcc.src/gcc/../libdecnumber -I../libdecnumber -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/include -DENABLE_LLVM -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/../llvm.src/include -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -o build/gencondmd.o build/gencondmd.c ../../llvm-gcc.src/gcc/config/i386/mmx.md:926: error: expected '}' before ')' token ../../llvm-gcc.src/gcc/config/i386/mmx.md:926: warning: excess elements in struct initializer ../../llvm-gcc.src/gcc/config/i386/mmx.md:926: warning: (near initialization for 'insn_conditions[4]') ../../llvm-gcc.src/gcc/config/i386/mmx.md:926: error: expected '}' before ')' token ../../llvm-gcc.src/gcc/config/i386/mmx.md:926: error: expected ',' or ';' before ')' token ../../llvm-gcc.src/gcc/config/i386/mmx.md:927: error: expected identifier or '(' before ',' token ../../llvm-gcc.src/gcc/config/i386/sse.md:3458: error: expected identifier or '(' before ',' token ... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62506 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR3016, a bug which can occur do to an invalid assumption:Chris Lattner2009-01-191-0/+30
| | | | | | | | | | we assumed a CFG structure that would be valid when all code in the function is reachable, but not all code is necessarily reachable. Do a simple, but horrible, CFG walk to check for this case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62487 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a helper to remove a branch and DCE the condition, and use it Eli Friedman2008-12-161-0/+46
| | | | | | | | | | consistently for deleting branches. In addition to being slightly more readable, this makes SimplifyCFG a bit better about cleaning up after itself when it makes conditions unused. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61100 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a bug I introduced in simplifycfg handling single entry phi Chris Lattner2008-12-071-0/+13
| | | | | | | | nodes. FoldSingleEntryPHINodes deletes the PHI, so there is no need to delete it afterward. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60653 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR2967 by not deleting volatile load/stores that occur before unreachable.Chris Lattner2008-10-291-0/+19
| | | | | | | | I don't really see this as being needed, but there is little harm from doing it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58385 91177308-0d34-0410-b5e6-96231b3b80d8
* Nick Lewycky's patch.Devang Patel2008-10-031-0/+36
| | | | | | | | While hosting instruction check PHI node. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57025 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not hoist instruction above branch condition. The instruction may use ↵Devang Patel2008-09-171-0/+18
| | | | | | branch condition. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56286 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix simplifycfg crash in handing block merge.Devang Patel2008-09-091-0/+60
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55971 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove GCSE and LoadVN from the testsuite.Owen Anderson2008-08-161-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54832 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix mishandling of the infinite loop case when merging two blocks. ThisChris Lattner2008-07-131-0/+36
| | | | | | | fixes PR2540. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53533 91177308-0d34-0410-b5e6-96231b3b80d8
* Speculatively execute a block when the the block is the then part of a ↵Evan Cheng2008-06-071-0/+21
| | | | | | | | | | | | | | | | | | | | | triangle shape and it contains a single, side effect free, cheap instruction. The branch is eliminated by adding a select instruction. i.e. Turn BB: %t1 = icmp br i1 %t1, label %BB1, label %BB2 BB1: %t3 = add %t2, c br label BB2 BB2: => BB: %t1 = icmp %t4 = add %t2, c %t3 = select i1 %t1, %t2, %t3 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52073 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix run line.Evan Cheng2008-06-071-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52072 91177308-0d34-0410-b5e6-96231b3b80d8
* Restucture a part of the SimplifyCFG pass and include a testcase.Matthijs Kooijman2008-05-231-0/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SimplifyCFG pass looks at basic blocks that contain only phi nodes, followed by an unconditional branch. In a lot of cases, such a block (BB) can be merged into their successor (Succ). This merging is performed by TryToSimplifyUncondBranchFromEmptyBlock. It does this by taking all phi nodes in the succesor block Succ and expanding them to include the predecessors of BB. Furthermore, any phi nodes in BB are moved to Succ and expanded to include the predecessors of Succ as well. Before attempting this merge, CanPropagatePredecessorsForPHIs checks to see if all phi nodes can be properly merged. All functional changes are made to this function, only comments were updated in TryToSimplifyUncondBranchFromEmptyBlock. In the original code, CanPropagatePredecessorsForPHIs looks quite convoluted and more like stack of checks added to handle different kinds of situations than a comprehensive check. In particular the first check in the function did some value checking for the case that BB and Succ have a common predecessor, while the last check in the function simply rejected all cases where BB and Succ have a common predecessor. The first check was still useful in the case that BB did not contain any phi nodes at all, though, so it was not completely useless. Now, CanPropagatePredecessorsForPHIs is restructured to to look a lot more similar to the code that actually performs the merge. Both functions now look at the same phi nodes in about the same order. Any conflicts (phi nodes with different values for the same source) that could arise from merging or moving phi nodes are detected. If no conflicts are found, the merge can happen. Apart from only restructuring the checks, two main changes in functionality happened. Firstly, the old code rejected blocks with common predecessors in most cases. The new code performs some extra checks so common predecessors can be handled in a lot of cases. Wherever common predecessors still pose problems, the blocks are left untouched. Secondly, the old code rejected the merge when values (phi nodes) from BB were used in any other place than Succ. However, it does not seem that there is any situation that would require this check. Even more, this can be proven. Consider that BB is a block containing of a single phi node "%a" and a branch to Succ. Now, since the definition of %a will dominate all of its uses, BB will dominate all blocks that use %a. Furthermore, since the branch from BB to Succ is unconditional, Succ will also dominate all uses of %a. Now, assume that one predecessor of Succ is not dominated by BB (and thus not dominated by Succ). Since at least one use of %a (but in reality all of them) is reachable from Succ, you could end up at a use of %a without passing through it's definition in BB (by coming from X through Succ). This is a contradiction, meaning that our original assumption is wrong. Thus, all predecessors of Succ must also be dominated by BB (and thus also by Succ). This means that moving the phi node %a from BB to Succ does not pose any problems when the two blocks are merged, and any use checks are not needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51478 91177308-0d34-0410-b5e6-96231b3b80d8
* sabre brings to my attention that the 'tr' suffix is also obsoleteGabor Greif2008-05-201-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51349 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename the last test with .llx extension to .ll, resolve duplicate test by ↵Gabor Greif2008-05-201-1/+1
| | | | | | renaming to isnan2. Now that no test has llx ending there is no need to search for them from dg.exp too. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51328 91177308-0d34-0410-b5e6-96231b3b80d8
* Update old-style syntax in some "not grep" tests.Dan Gohman2008-05-014-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50560 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR2256, yet another miscompilation in simplifycfg of iChris Lattner2008-04-281-0/+30
| | | | | | | | | multiple return values. Bill, please pull this into Tak. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50332 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989Nick Lewycky2008-04-251-61/+0
| | | | | | | r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50265 91177308-0d34-0410-b5e6-96231b3b80d8
* Split some code out of the main SimplifyCFG loop into its own function.Chris Lattner2008-04-241-0/+43
| | | | | | | | Fix said code to handle merging return instructions together correctly when handling multiple return values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50199 91177308-0d34-0410-b5e6-96231b3b80d8
* Upgrade tests.Tanya Lattner2008-03-191-62/+62
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48536 91177308-0d34-0410-b5e6-96231b3b80d8
* Upgrade tests to not use llvm-upgrade.Tanya Lattner2008-03-1823-501/+453
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48483 91177308-0d34-0410-b5e6-96231b3b80d8
* Check to see if a two-entry PHI block can be simplifiedDan Gohman2008-03-111-0/+15
| | | | | | | | | before trying to merge the block into its predecessors. This allows two-entry-phi-return.ll to be simplified into a single basic block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48252 91177308-0d34-0410-b5e6-96231b3b80d8
* Make this test more challenging to help it avoid beingDan Gohman2008-03-111-2/+8
| | | | | | | optimized away before it tests what it is intended to test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48251 91177308-0d34-0410-b5e6-96231b3b80d8
* Upgrade this test.Dan Gohman2008-03-111-6/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48207 91177308-0d34-0410-b5e6-96231b3b80d8