1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

59 Commits

Author SHA1 Message Date
Devang Patel
3ae9d5d375 While hoisting instruction to speculatively execute simple bb, ignore dbg intrinsics.
llvm-svn: 66255
2009-03-06 06:00:17 +00:00
Zhou Sheng
670d50e102 Ignore dbg info intrinsics when folding conditional branch to
conditional branch predecessors.

llvm-svn: 65509
2009-02-26 06:56:37 +00:00
Zhou Sheng
241d74737b Don't block basic block with only SwitchInst to fold into predecessors.
llvm-svn: 65456
2009-02-25 15:34:27 +00:00
Devang Patel
702836b2dd While folding unconditional return move DbgRegionEndInst into the 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

llvm-svn: 65353
2009-02-24 00:05:16 +00:00
Devang Patel
dd611eac76 If llvm.dbg.region.end is disappearing then remove corresponding llvm.dbg.func.start also.
llvm-svn: 64278
2009-02-11 01:29:06 +00:00
Devang Patel
60571be0de Ignore dbg intrinsic while folding unconditional branch.
llvm-svn: 64242
2009-02-10 22:14:17 +00:00
Devang Patel
e665f78460 Ignore dbg intrinsics while folding switch instruction.
llvm-svn: 63802
2009-02-05 00:30:42 +00:00
Devang Patel
10be164b28 Ignore dbg intrinsics.
llvm-svn: 63781
2009-02-04 21:39:48 +00:00
Devang Patel
2fac28a8c7 While folding vallue comparison terminators ignore dbg intrinsics.
llvm-svn: 63700
2009-02-04 01:06:11 +00:00
Devang Patel
bc5a1a7007 Ignore dbg intrinsics while hoisting common code in the two blocks up into the branch block.
llvm-svn: 63687
2009-02-04 00:03:08 +00:00
Devang Patel
4b56b3c66e Do not let dbg intrinsic block folding of two entry phi node.
llvm-svn: 63671
2009-02-03 22:12:02 +00:00
Chris Lattner
d3b233ba51 fix a testcase.
llvm-svn: 62758
2009-01-22 07:08:58 +00:00
Bill Wendling
5bd5863cdb Temporarily XFAIL until this can be looked at. r62557 is what caused it to start failing.
llvm-svn: 62578
2009-01-20 10:28:39 +00:00
Chris Lattner
6ade48fcaa another fix for PR3354
llvm-svn: 62561
2009-01-20 01:15:41 +00:00
Chris Lattner
e8fa6f2468 Fix a problem exposed by PR3354: simplifycfg was making a potentially
trapping instruction be executed unconditionally.

llvm-svn: 62541
2009-01-19 23:03:13 +00:00
Chris Lattner
7b4c55fb34 convert this to an unfoldable potentially trapping constant expr.
llvm-svn: 62536
2009-01-19 22:12:33 +00:00
Bill Wendling
bf83203ae6 Temporarily revert r62487. It's causing this error during a release bootstrap of
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
...

llvm-svn: 62506
2009-01-19 08:46:20 +00:00
Chris Lattner
bb76cc9447 Fix PR3016, a bug which can occur do to an invalid assumption:
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.

llvm-svn: 62487
2009-01-19 02:46:28 +00:00
Eli Friedman
de614f9842 Add a helper to remove a branch and DCE the condition, and use it
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.

llvm-svn: 61100
2008-12-16 20:54:32 +00:00
Chris Lattner
a79a341f1e fix a bug I introduced in simplifycfg handling single entry phi
nodes. FoldSingleEntryPHINodes deletes the PHI, so there is no
need to delete it afterward.

llvm-svn: 60653
2008-12-07 07:22:45 +00:00
Chris Lattner
4af91a146a Fix PR2967 by not deleting volatile load/stores that occur before unreachable.
I don't really see this as being needed, but there is little harm from doing
it.

llvm-svn: 58385
2008-10-29 17:46:26 +00:00
Devang Patel
55401473f9 Nick Lewycky's patch.
While hosting instruction check PHI node.

llvm-svn: 57025
2008-10-03 18:57:37 +00:00
Devang Patel
88efee2dcc Do not hoist instruction above branch condition. The instruction may use branch condition.
llvm-svn: 56286
2008-09-17 18:21:49 +00:00
Devang Patel
b6380f607d Fix simplifycfg crash in handing block merge.
llvm-svn: 55971
2008-09-09 01:06:56 +00:00
Owen Anderson
42c1d6c7b9 Remove GCSE and LoadVN from the testsuite.
llvm-svn: 54832
2008-08-16 00:00:54 +00:00
Chris Lattner
3444f4d4c4 Fix mishandling of the infinite loop case when merging two blocks. This
fixes PR2540.

llvm-svn: 53533
2008-07-13 22:23:11 +00:00
Evan Cheng
c7ed1b9258 Speculatively execute a block when the the block is the then part of a 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

llvm-svn: 52073
2008-06-07 08:52:29 +00:00
Evan Cheng
bc28ef2028 Fix run line.
llvm-svn: 52072
2008-06-07 08:40:16 +00:00
Matthijs Kooijman
cf417144f6 Restucture a part of the SimplifyCFG pass and include a testcase.
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.

llvm-svn: 51478
2008-05-23 09:09:41 +00:00
Gabor Greif
807c2df887 sabre brings to my attention that the 'tr' suffix is also obsolete
llvm-svn: 51349
2008-05-20 21:00:03 +00:00
Gabor Greif
d8a4dbb5da Rename the last test with .llx extension to .ll, resolve duplicate test by renaming to isnan2. Now that no test has llx ending there is no need to search for them from dg.exp too.
llvm-svn: 51328
2008-05-20 19:52:04 +00:00
Dan Gohman
04e2b94842 Update old-style syntax in some "not grep" tests.
llvm-svn: 50560
2008-05-01 23:50:07 +00:00
Chris Lattner
ede7e89144 Fix PR2256, yet another miscompilation in simplifycfg of i
multiple return values.

Bill, please pull this into Tak.

llvm-svn: 50332
2008-04-28 00:19:07 +00:00
Nick Lewycky
1f831c0f57 Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989
r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123.

llvm-svn: 50265
2008-04-25 16:53:59 +00:00
Chris Lattner
be35a0c224 Split some code out of the main SimplifyCFG loop into its own function.
Fix said code to handle merging return instructions together correctly
when handling multiple return values.

llvm-svn: 50199
2008-04-24 00:01:19 +00:00
Tanya Lattner
f0dc625b4f Upgrade tests.
llvm-svn: 48536
2008-03-19 05:39:35 +00:00
Tanya Lattner
60b7b29981 Upgrade tests to not use llvm-upgrade.
llvm-svn: 48483
2008-03-18 03:45:45 +00:00
Dan Gohman
34ea45f10d Check to see if a two-entry PHI block can be simplified
before trying to merge the block into its predecessors.
This allows two-entry-phi-return.ll to be simplified
into a single basic block.

llvm-svn: 48252
2008-03-11 21:53:06 +00:00
Dan Gohman
05907c9f06 Make this test more challenging to help it avoid being
optimized away before it tests what it is intended to test.

llvm-svn: 48251
2008-03-11 21:47:57 +00:00
Dan Gohman
2674ad5bed Upgrade this test.
llvm-svn: 48207
2008-03-11 02:19:59 +00:00
Tanya Lattner
8ac346c316 Remove llvm-upgrade and update tests.
llvm-svn: 48137
2008-03-10 07:21:50 +00:00
Nick Lewycky
5dd879d5b5 Turn unwind_to into "unwinds to".
llvm-svn: 48123
2008-03-10 02:20:00 +00:00
Nick Lewycky
4732d3c9b7 Firstly, having a BranchInst isn't exclusive with having an unwind_to.
Secondly, we have to check whether the branch is actually pointing to the block
with the unwind in it. We could have gotten here because of the unwind_to alone.

llvm-svn: 48099
2008-03-09 07:50:37 +00:00
Nick Lewycky
e93a1819dc A BB that unwind_to an "unwind" inst is that same as one that doesn't unwind_to
at all.

llvm-svn: 48096
2008-03-09 07:36:38 +00:00
Nick Lewycky
d98272094e Update the inliner and simplifycfg to handle unwind_to.
llvm-svn: 48086
2008-03-09 05:10:13 +00:00
Chris Lattner
26b89fd30a don't hoist FP additions into unconditional adds + selects. This
could theoretically introduce a trap, but is also a performance issue.
This speeds up ptrdist/ks by 8%.

llvm-svn: 45533
2008-01-03 07:25:26 +00:00
Devang Patel
d601ada369 Test -simplifycfg only.
llvm-svn: 45389
2007-12-28 22:59:48 +00:00
Devang Patel
e035f776e9 If succ has succ itself as one of the predecessors then do
not merge current bb and succ even if bb's terminator is
unconditional branch to succ.

llvm-svn: 45305
2007-12-22 01:32:53 +00:00
Duncan Sands
1b0feb42e2 Add some convenience methods for querying attributes, and
use them.

llvm-svn: 44403
2007-11-28 17:07:01 +00:00
Duncan Sands
3602011bec Fix PR1146: parameter attributes are longer part of
the function type, instead they belong to functions
and function calls.  This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll).  Hopefully
a bitcode guru (who might that be? :) ) will fix it.

llvm-svn: 44359
2007-11-27 13:23:08 +00:00