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

176 Commits

Author SHA1 Message Date
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
Chris Lattner
af6f58bbf4 reduce indentation by using 'continue', no functionality change.
llvm-svn: 62477
2009-01-19 02:07:32 +00:00
Chris Lattner
c03b442e54 Fix some problems in SpeculativelyExecuteBB. Basically,
because of dead code, a phi could use the speculated instruction
that was not in "BB2".  Make this check explicit and tighten up 
some other corners.  This fixes PR3292.  No testcase becauase this
depends entirely on visitation order of blocks and requires a 
sequence of 8 passes to repro.

llvm-svn: 62476
2009-01-19 00:36:37 +00:00
Chris Lattner
ead19aaccb Make this a bit more explicit about which cases need the
check.  No functionality change.

llvm-svn: 62474
2009-01-18 23:22:07 +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
420385f8c3 Factor some code into a new FoldSingleEntryPHINodes method.
llvm-svn: 60501
2008-12-03 19:44:02 +00:00
Chris Lattner
7a00825f57 Rename DeleteBlockIfDead to DeleteDeadBlock and make it
unconditionally delete the block.  All likely clients will
do the checking anyway.

llvm-svn: 60464
2008-12-03 06:40:52 +00:00
Chris Lattner
12c3938837 Factor some code out of SimplifyCFG, forming a new
DeleteBlockIfDead method.

llvm-svn: 60463
2008-12-03 06:37:44 +00:00
Chris Lattner
4486266c9d delete ErasePossiblyDeadInstructionTree, replacing uses of it with
RecursivelyDeleteTriviallyDeadInstructions.

llvm-svn: 60196
2008-11-27 23:25:44 +00:00
Chris Lattner
cab07ddaeb simplify this code a bit.
llvm-svn: 60164
2008-11-27 07:54:38 +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
64dd7a2e89 Large mechanical patch.
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g

This sets the stage 
- to implement function notes as function attributes and 
- to distinguish between function attributes and return value attributes.

This requires corresponding changes in llvm-gcc and clang.

llvm-svn: 56622
2008-09-25 21:00:45 +00:00
Devang Patel
201223af46 Try to place hoisted instructions befoe icmp instruction.
llvm-svn: 56315
2008-09-18 22:50:42 +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
Dan Gohman
027326ba3e Use empty() instead of begin() == end().
llvm-svn: 54780
2008-08-14 18:13:49 +00:00
Dan Gohman
6564581be0 Enable first-class aggregates support.
Remove the GetResultInst instruction. It is still accepted in LLVM assembly
and bitcode, where it is now auto-upgraded to ExtractValueInst. Also, remove
support for return instructions with multiple values. These are auto-upgraded
to use InsertValueInst instructions.

The IRBuilder still accepts multiple-value returns, and auto-upgrades them
to InsertValueInst instructions.

llvm-svn: 53941
2008-07-23 00:34:11 +00:00
Owen Anderson
bba5ddaf0f Reapply r53735. My last patch fixed the failures Dan observed.
llvm-svn: 53761
2008-07-18 17:49:43 +00:00
Dan Gohman
4dc7526774 Revert r53735. It broke SPEC 464.h264ref.
llvm-svn: 53757
2008-07-18 16:44:49 +00:00
Owen Anderson
8e971c22fd Use MergeBlockIntoPredecessor to simplify some code.
llvm-svn: 53735
2008-07-17 20:00:46 +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
Chris Lattner
7cb257551f more refactoring. Use early exits instead of really complex logic.
No functionality change.

llvm-svn: 53532
2008-07-13 22:04:41 +00:00
Chris Lattner
a4a80e0092 improve comments.
llvm-svn: 53531
2008-07-13 21:55:46 +00:00
Chris Lattner
824fbca1ee factor another large hunk of code out into its own function.
No functionality change.

llvm-svn: 53530
2008-07-13 21:53:26 +00:00
Chris Lattner
67bf4acd15 Final bit of simplification for FoldBranchToCommonDest.
llvm-svn: 53528
2008-07-13 21:20:19 +00:00
Chris Lattner
3346d311c7 simplify logic a bit
llvm-svn: 53527
2008-07-13 21:15:11 +00:00
Chris Lattner
2ac1854097 Refactor some code out into its own helper function, getting rid of crazy multiline
conditionals and commenting the code better.

No functionality change.

llvm-svn: 53526
2008-07-13 21:12:01 +00:00
Evan Cheng
9a3db8fb91 - Use O(1) check of basic block size limit.
- Avoid speculatively execute vector ops.

llvm-svn: 52703
2008-06-25 07:50:12 +00:00
Evan Cheng
5897328890 Do not speculatively execute an instruction by hoisting it to its predecessor BB if any of its operands are defined but not used in BB. The transformation will prevent the operand from being sunk into the use block.
llvm-svn: 52244
2008-06-12 21:15:59 +00:00
Evan Cheng
7b7a321f64 For now, avoid generating FP select instructions in order to speculatively execute integer arithmetic instructions. FP selects are more likely to be expensive (even compared to branch on fcmp). This is not a wonderful solution but I rather err on the side of conservative.
This fixes the heapsort performance regressions.

llvm-svn: 52224
2008-06-11 19:18:20 +00:00
Gabor Greif
519129edc8 op_iterator-ify loops
llvm-svn: 52191
2008-06-10 22:03:26 +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
Dan Gohman
8b6f4366ae Tidy up BasicBlock::getFirstNonPHI, and change a bunch of places to
use it instead of duplicating its functionality.

llvm-svn: 51499
2008-05-23 21:05:58 +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
d61f20217a API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. Legacy interfaces will be in place for some time. (Merge from use-diet branch.)
llvm-svn: 51200
2008-05-16 19:29:10 +00:00
Gabor Greif
48ffb6c7dc Fix a bunch of 80col violations that arose from the Create API change. Tweak makefile targets to find these better.
llvm-svn: 51143
2008-05-15 10:04:30 +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
Gabor Greif
6c6b8a57f3 API changes for class Use size reduction, wave 1.
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.

llvm-svn: 49277
2008-04-06 20:25:17 +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
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
Anton Korobeynikov
fd6b669c80 Make Transforms to be 4.3 warnings-clean
llvm-svn: 47371
2008-02-20 11:26:25 +00:00
Chris Lattner
b22dbdf4fc switch simplifycfg from using vectors for most things to smallvectors,
this speeds it up 2.3% on eon.

llvm-svn: 47261
2008-02-18 07:42:56 +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