Dan Gohman
d5743c7fd0
Consider ObjC runtime calls objc_storeWeak and others which make a copy of
...
their argument as "escape" points for objc_retainBlock optimization.
This fixes rdar://11229925.
llvm-svn: 154682
2012-04-13 18:28:58 +00:00
Dan Gohman
81ac0c921f
Use the new Use-aware dominates method to apply the objc runtime
...
library return value optimization for phi uses. Even when the
phi itself is not dominated, the specific use may be dominated.
llvm-svn: 154647
2012-04-13 01:08:28 +00:00
Dan Gohman
6a5b02f8ee
Don't move objc_autorelease calls past autorelease pool boundaries when
...
optimizing autorelease calls on phi nodes with null operands.
This fixes rdar://11207070.
llvm-svn: 154642
2012-04-13 00:59:57 +00:00
Dan Gohman
a5e2200b2a
Fix accidentally inverted logic from r152803, and make the
...
testcase slightly less trivial. This fixes rdar://11171718.
llvm-svn: 154118
2012-04-05 20:27:21 +00:00
Dan Gohman
ef28237798
Don't convert objc_retainAutoreleasedReturnValue to objc_retain if it
...
is retaining the return value of an invoke that it immediately follows.
llvm-svn: 153344
2012-03-23 18:09:00 +00:00
Dan Gohman
0c02608af1
It's not possible to insert code immediately after an invoke in the
...
same basic block, and it's not safe to insert code in the successor
blocks if the edges are critical edges. Splitting those edges is
possible, but undesirable, especially on the unwind side. Instead,
make the bottom-up code motion to consider invokes to be part of
their successor blocks, rather than part of their parent blocks, so
that it doesn't push code past them and onto the edges. This fixes
PR12307.
llvm-svn: 153343
2012-03-23 17:47:54 +00:00
Rafael Espindola
ac42573389
Short term fix for pr12270 before we change dominates to handle unreachable
...
code.
While here, reduce indentation.
llvm-svn: 152803
2012-03-15 15:52:59 +00:00
Dan Gohman
a30e1f4576
When an invoke is marked with metadata indicating its unwind edge
...
should be ignored by ARC optimization, don't insert new ARC runtime
calls in the unwind destination.
llvm-svn: 152748
2012-03-14 23:05:06 +00:00
Dan Gohman
784659a39f
When identifying exit nodes for the reverse-CFG reverse-post-order
...
traversal, consider nodes for which the only successors are backedges
which the traversal is ignoring to be exit nodes. This fixes a problem
where the bottom-up traversal was failing to visit split blocks along
split loop backedges. This fixes rdar://10989035.
llvm-svn: 152421
2012-03-09 18:50:52 +00:00
Dan Gohman
71b80f9e8c
Calls and invokes with the new clang.arc.no_objc_arc_exceptions
...
metadata may still unwind, but only in ways that the ARC
optimizer doesn't need to consider. This permits more
aggressive optimization.
llvm-svn: 150829
2012-02-17 18:59:53 +00:00
Eli Bendersky
4afdeeb682
Replace all instances of dg.exp file with lit.local.cfg, since all tests are run with LIT now and now Dejagnu. dg.exp is no longer needed.
...
Patch reviewed by Daniel Dunbar. It will be followed by additional cleanup patches.
llvm-svn: 150664
2012-02-16 06:28:33 +00:00
Dan Gohman
20fd978e4b
Just like in regular escape analysis, loads and stores through
...
(but not of) a block pointer do not cause the block pointer to
escape. This fixes rdar://10803830.
llvm-svn: 150424
2012-02-13 22:57:02 +00:00
Dan Gohman
9bb84ffb6c
Set the "tail" flag on pattern-matched objc_storeStrong calls.
...
rdar://10531041.
llvm-svn: 148490
2012-01-19 19:14:36 +00:00
Dan Gohman
48f4e5752e
Use llvm.global_ctors to locate global constructors instead
...
of recognizing them by name.
llvm-svn: 148416
2012-01-18 21:19:38 +00:00
Dan Gohman
9b37a5592c
Add a new ObjC ARC optimization pass to eliminate unneeded
...
autorelease push+pop pairs.
llvm-svn: 148330
2012-01-17 20:52:24 +00:00
Dan Gohman
922244c634
Implement proper ObjC ARC objc_retainBlock "escape" analysis, so that
...
the optimizer doesn't eliminate objc_retainBlock calls which are needed
for their side effect of copying blocks onto the heap.
This implements rdar://10361249.
llvm-svn: 148076
2012-01-13 00:39:07 +00:00
Dan Gohman
e9572aa680
It turns out that clang does use pointer-to-function types to
...
point to ARC-managed pointers sometimes. This fixes rdar://10551239.
llvm-svn: 146577
2011-12-14 19:10:53 +00:00
Chris Lattner
9d1e8420ff
Upgrade syntax of tests using volatile instructions to use 'load volatile' instead of 'volatile load', which is archaic.
...
llvm-svn: 145171
2011-11-27 06:54:59 +00:00
Dan Gohman
5e2d8538d7
Teach the ARC optimizer about the !clang.arc.copy_on_escape metadata
...
tag on objc_retainBlock calls, which indicates that they may be
optimized away. rdar://10211286.
llvm-svn: 142298
2011-10-17 22:53:25 +00:00
Dan Gohman
13624a6c83
Suppress partial retain+release elimination when there's a
...
possibility that it will span multiple CFG diamonds/triangles which
could have different controlling predicates. rdar://10282956
llvm-svn: 142222
2011-10-17 18:48:25 +00:00
Dan Gohman
7dca165e93
When eliminating unnecessary retain+autorelease on return values,
...
handle the case where the retain is in a different basic block.
rdar://10210274.
llvm-svn: 140815
2011-09-29 22:27:34 +00:00
Dan Gohman
2df048a94b
Don't eliminate objc_retainBlock calls on stack objects if the
...
objc_retainBlock call is potentially responsible for copying
the block to the heap to extend its lifetime. rdar://10209613.
llvm-svn: 140814
2011-09-29 22:25:23 +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
Bill Wendling
722de8a9aa
Update more tests to the new EH scheme.
...
llvm-svn: 138894
2011-08-31 21:04:11 +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
Dan Gohman
48e3f904c3
Make a few tests slightly more strict.
...
llvm-svn: 138241
2011-08-22 17:27:02 +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
Eli Friedman
baf0f69f9a
Move "atomic" and "volatile" designations on instructions after the opcode
...
of the instruction.
Note that this change affects the existing non-atomic load and store
instructions; the parser now accepts both forms, and the change is noted
in the release notes.
llvm-svn: 137527
2011-08-12 22:50:01 +00:00
Dan Gohman
c188a47b62
Don't convert objc_autoreleaseReturnValue to objc_autorelease if the result
...
is returned through a bitcast.
llvm-svn: 137402
2011-08-12 00:36:31 +00:00
Dan Gohman
783fdc6375
Don't let arbitrary calls disrupt nested retain+release pairs if
...
the retains and releases all use the same SSA pointer value.
Also, don't let CFG hazards disrupt nested retain+release pair
optimizations.
llvm-svn: 137399
2011-08-12 00:26:31 +00:00
Dan Gohman
a716e5c67e
Tidy up these testcases to look more like real code does.
...
llvm-svn: 137085
2011-08-09 00:33:11 +00:00
Dan Gohman
1c4dff0ab3
Move the last uses of RetainFunc etc. over to using getRetainCallee() etc.
...
so that a declaration for objc_retain is created when needed if it doesn't
already exist. rdar://9825114.
llvm-svn: 135821
2011-07-22 22:29:21 +00:00
Dan Gohman
c9b4620575
Fix ARCOpt to insert releases on both successors of an invoke rather
...
than trying to insert them immediately after the invoke.
llvm-svn: 133188
2011-06-16 20:57:14 +00:00
John McCall
519c63cdeb
The ARC language-specific optimizer. Credit to Dan Gohman.
...
llvm-svn: 133108
2011-06-15 23:37:01 +00:00