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

8331 Commits

Author SHA1 Message Date
Dan Gohman
f4d52b917e Don't mark objc_retainBlock as nounwind. It calls user copy constructors
which could theoretically throw.

llvm-svn: 139710
2011-09-14 18:33:34 +00:00
Dan Gohman
223fdfc56f objc_retainBlock is not NoModRef because it can update forwarding pointers
in memory relevant to the optimizer. rdar://10050579.

llvm-svn: 139708
2011-09-14 18:13:00 +00:00
Andrew Trick
2e22ddc364 [indvars] Revert r139579 until 401.bzip -arch i386 miscompilation is fixed. PR10920.
llvm-svn: 139583
2011-09-13 05:23:49 +00:00
Andrew Trick
2bfa2824c6 Disable IV rewriting by default. See PR10916.
llvm-svn: 139579
2011-09-13 03:23:21 +00:00
Andrew Trick
2cc8637af2 [indvars] Fix bugs in floating point IV range checks noticed by inspection.
llvm-svn: 139574
2011-09-13 01:59:32 +00:00
Eli Friedman
3f92f87989 Add comment to clarify the behavior of a helper in DSE.
llvm-svn: 139571
2011-09-13 01:28:59 +00:00
Eli Friedman
ce1cbc7db5 Correct grammar.
llvm-svn: 139565
2011-09-13 00:44:16 +00:00
Eli Friedman
047d3de417 Change a bunch of isVolatile() checks to check for atomic load/store as well.
No tests; these changes aren't really interesting in the sense that the logic is the same for volatile and atomic.

I believe this completes all of the changes necessary for the optimizer to handle loads and stores correctly.  I'm going to try and come up with some additional testing, though.

llvm-svn: 139533
2011-09-12 20:23:13 +00:00
Andrew Trick
09cf4287c2 Rename -disable-iv-rewrite to -enable-iv-rewrite=false in preparation for default change.
llvm-svn: 139517
2011-09-12 18:28:44 +00:00
Andrew Trick
cf4ef9bded [disable-iv-rewrite] Allow WidenIV to handle NSW/NUW operations
better.

Don't immediately give up when an add operation can't be trivially
sign/zero-extended within a loop. If it has NSW/NUW flags, generate a
new expression with sign extended (non-recurrent) operand. As before,
if SCEV says that all sign extends are loop invariant, then we can
widen the operation.

llvm-svn: 139453
2011-09-10 01:24:17 +00:00
Andrew Trick
77fa88a786 Comment formatting.
llvm-svn: 139375
2011-09-09 17:35:10 +00:00
Andrew Trick
8145f71bab Add -verify-indvars for imperfect SCEV trip count verification after indvars.
llvm-svn: 139169
2011-09-06 20:20:38 +00:00
Devang Patel
1366637777 Use IRBuilder.
llvm-svn: 139156
2011-09-06 18:49:53 +00:00
Owen Anderson
ca0326a423 Try again at r138809 (make DSE more aggressive in removing dead stores at the end of a function), now with less deleting stores before memcpy's.
llvm-svn: 139150
2011-09-06 18:14:09 +00:00
Duncan Sands
6939ae53ac Split the init.trampoline intrinsic, which currently combines GCC's
init.trampoline and adjust.trampoline intrinsics, into two intrinsics
like in GCC.  While having one combined intrinsic is tempting, it is
not natural because typically the trampoline initialization needs to
be done in one function, and the result of adjust trampoline is needed
in a different (nested) function.  To get around this llvm-gcc hacks the
nested function lowering code to insert an additional parent variable
holding the adjust.trampoline result that can be accessed from the child
function.  Dragonegg doesn't have the luxury of tweaking GCC code, so it
stored the result of adjust.trampoline in the memory GCC set aside for
the trampoline itself (this is always available in the child function),
and set up some new memory (using an alloca) to hold the trampoline.
Unfortunately this breaks Go which allocates trampoline memory on the
heap and wants to use it even after the parent has exited (!).  Rather
than doing even more hacks to get Go working, it seemed best to just use
two intrinsics like in GCC.  Patch mostly by Sanjoy Das.

llvm-svn: 139140
2011-09-06 13:37:06 +00:00
Duncan Sands
d883f9f371 Delete trivial landing pads that just continue unwinding the caught
exception.

llvm-svn: 139117
2011-09-05 12:57:57 +00:00
Bill Wendling
0506959970 Use Duncan's patch to delete the instructions in reverse order (minus the landingpad and terminator).
llvm-svn: 139090
2011-09-04 09:43:36 +00:00
Bill Wendling
3033d7846d Update comments to reflect reality.
llvm-svn: 139023
2011-09-02 18:43:33 +00:00
Andrew Trick
36b96e4619 Enable SCEV-based unrolling by default.
This changes loop unrolling to use the same mechanism for trip count
computation as indvars. This is a stronger check that tends to unroll
more loops. A very common side-effect is that many single iteration
loops will be removed sooner. The real goal was simply to remove
dependence on canonical IVs.

x86 is break even.
ARM performance changes to expect (+ is good):
External/SPEC/CFP2000/183.equake/183.equake +13%
SingleSource/Benchmarks/Dhrystone/fldry     +21%
MultiSource/Applications/spiff/spiff         +3%
SingleSource/Benchmarks/Stanford/Puzzle     -14%

The Puzzle regression is actually an improvement in loop optimization
that defeats GVN: rdar://problem/10065079.

llvm-svn: 139009
2011-09-02 17:26:28 +00:00
Jakub Staszak
b82758ae9b Compare type size instead of type _store_ size to make sure that BitCastInst
will be valid. This fixes PR10820.

llvm-svn: 139005
2011-09-02 14:57:37 +00:00
Bill Wendling
b6a419d0f0 Reduce indentation. No functionality change.
llvm-svn: 138968
2011-09-01 21:29:49 +00:00
Bill Wendling
759eb19f0b Change worklist driven deletion to be an iterative process.
Duncan noticed this!

llvm-svn: 138967
2011-09-01 21:28:33 +00:00
Eli Friedman
00a62b2122 Fix an issue with the IR sink pass found by inspection. (I'm not sure anyone is actually using this, but might as well fix it since I found the issue.)
llvm-svn: 138965
2011-09-01 21:21:24 +00:00
Bill Wendling
a6d17107f5 Resubmit with fix. Properly remove the instructions except for landingpad, which should be removed only when its invokes are.
llvm-svn: 138932
2011-09-01 01:28:11 +00:00
Bill Wendling
d984ff9663 Submitted this too early.
llvm-svn: 138931
2011-09-01 01:18:33 +00:00
Bill Wendling
37fc90ccd9 Don't DCE the landingpad instruction.
The landingpad instruction can be removed only when its invokes are removed.

llvm-svn: 138930
2011-09-01 01:16:58 +00:00
Bill Wendling
df24e0d185 Make sure we aren't deleting the landingpad instruction.
The landingpad instruction is required in the landing pad block. Because we're
not deleting terminating instructions, the invoke may still jump to here (see
Transforms/SCCP/2004-11-16-DeadInvoke.ll). Remove all uses of the landingpad
instruction, but keep it around until code-gen can remove the basic block.

llvm-svn: 138890
2011-08-31 20:55:20 +00:00
Rafael Espindola
3bb0f9391c Remove the old tail duplication pass. It is not used and is unable to update
ssa, so it has to be run really early in the pipeline. Any replacement
should probably use the SSAUpdater.

llvm-svn: 138841
2011-08-30 23:03:45 +00:00
Owen Anderson
d3a9f00a58 Speculatively revert r138809 in an attempt to fix DragonEgg.
llvm-svn: 138829
2011-08-30 21:11:06 +00:00
Owen Anderson
3ec8beb8c8 When walking backwards to eliminate final stores to allocas at the end of a function, encountering an unrelated store should not cause us to give up like encountering a load does.
llvm-svn: 138809
2011-08-30 18:51:55 +00:00
Nadav Rotem
43912ff374 Fixes following the CR by Chris and Duncan:
Optimize chained bitcasts of the form A->B->A.
Undo r138722 and change isEliminableCastPair to allow this case.

llvm-svn: 138756
2011-08-29 19:58:36 +00:00
Nadav Rotem
6280c8eecc Bitcasts are transitive. Bitcast-Bitcast-X becomes Bitcast-X.
llvm-svn: 138722
2011-08-28 11:51:08 +00:00
Bill Wendling
400ec8bd8f Don't sink landingpad instructions during ind-var simplification.
llvm-svn: 138651
2011-08-26 20:40:15 +00:00
Benjamin Kramer
0e1a09f38c Address review comments.
- Reword comments.
- Allow undefined behavior interfering with undefined behavior.
- Add address space checks.

llvm-svn: 138619
2011-08-26 02:25:55 +00:00
Benjamin Kramer
dc1c57af91 SimplifyCFG: If we have a PHI node that can evaluate to NULL and do a load or store to the address returned by the PHI node then we can consider this incoming value as dead and remove the edge pointing there, unless there are instructions that can affect control flow executed in between.
In theory this could be extended to other instructions, eg. division by zero, but it's likely that it will "miscompile" some code because people depend on div by zero not trapping. NULL pointer dereference usually leads to a crash so we should be on the safe side.

This shrinks the size of a Release clang by 16k on x86_64.

llvm-svn: 138618
2011-08-26 01:22:29 +00:00
Bill Wendling
1eec5affec LSR wants to split the landing pad's critical edge. Let it do it, but use the
proper function to do it.

llvm-svn: 138550
2011-08-25 05:55:40 +00:00
Bill Wendling
bc21b6ec6d When inserting new instructions, use getFirstInsertionPt instead of
getFirstNonPHI so that it will skip over the landingpad instructions as well.

llvm-svn: 138537
2011-08-25 01:08:34 +00:00
Bill Wendling
15062f817a Skip the landingpad instruction when determining the insertion point.
llvm-svn: 138481
2011-08-24 21:06:46 +00:00
Bill Wendling
0301dcfde8 Use getFirstInsertionPt instead of getFirstNonPHI so that it skips to the proper
insertion place.

llvm-svn: 138473
2011-08-24 20:28:43 +00:00
Rafael Espindola
e864ec28bd Fix a crashing bug in SplitBlock when it is called on a block with no
dominator information even though dominators were previously computed.

Patch by Nick Sumner.

llvm-svn: 138449
2011-08-24 18:07:01 +00:00
Dan Gohman
a6ceaf82c5 Add a comment.
llvm-svn: 138243
2011-08-22 17:29:37 +00:00
Dan Gohman
9619488506 Constant pointers to objects don't need reference counting.
llvm-svn: 138242
2011-08-22 17:29:11 +00:00
Bill Wendling
bfc0c6c1de If we're splitting the landing pad block and assigning it only one predecessor,
then don't split it a second time, since that block will be dead.

llvm-svn: 138153
2011-08-19 23:46:30 +00:00
Bill Wendling
31d80032c6 The landingpad instruction isn't dead simply because it's value isn't used.
llvm-svn: 138102
2011-08-19 21:52:06 +00:00
Benjamin Kramer
0d60a5573c Make a bunch of symbols private.
llvm-svn: 138025
2011-08-19 01:42:18 +00:00
Benjamin Kramer
c5a90f3683 C API functions must be able to see their extern "C" definitions, or it will be impossible to call them from C.
llvm-svn: 138022
2011-08-19 01:36:54 +00:00
Dan Gohman
c5d64c76e0 Track a retain+release nesting level independently of the
known-incremented level, because the two concepts can be used
to prove the saftey of a retain+release removal in different
ways.

llvm-svn: 138016
2011-08-19 00:26:36 +00:00
Bill Wendling
4eead96931 Intelligently split the landing pad block.
We have to be careful when splitting the landing pad block, because the
landingpad instruction is required to remain as the first non-PHI of an invoke's
unwind edge. To retain this, we split the block into two blocks, moving the
predecessors within the loop to one block and the remaining predecessors to the
other. The landingpad instruction is cloned into the new blocks.

llvm-svn: 138015
2011-08-19 00:09:22 +00:00
Bill Wendling
3079e1ccda Add SplitLandingPadPredecessors().
SplitLandingPadPredecessors is similar to SplitBlockPredecessors in that it
splits the current block and attaches a set of predecessors to the new basic
block. However, it differs from SplitBlockPredecessors in that it's specifically
designed to handle landing pad blocks.

Two new basic blocks are created: one that is has the vector of predecessors as
its predecessors and one that has the remaining predecessors as its
predecessors. Those two new blocks then receive a cloned copy of the landingpad
instruction from the original block. The landingpad instructions are joined in a
PHI, etc. Like SplitBlockPredecessors, it updates the LLVM IR, AliasAnalysis,
DominatorTree, DominanceFrontier, LoopInfo, and LCCSA analyses.

llvm-svn: 138014
2011-08-19 00:05:40 +00:00
Bill Wendling
ba667af404 Use 'getFirstInsertionPt' when trying to insert new instructions during LICM.
llvm-svn: 138008
2011-08-18 23:42:36 +00:00