Dan Gohman
8478d76d64
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
cc64bbca81
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
e3ed2b0699
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
5c70fadc17
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
f58927855b
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
532fb8131b
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
500b598c5c
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
0155f30a9c
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
924f9a671d
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
eb6e01533a
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
8ee108bf98
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
82041c2e60
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
e7a243fea5
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
728db4997a
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
bd944b4153
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
6a144a2227
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
a7107f992e
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
1736c14b85
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
4ac148dcbc
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
2053a5dd64
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
d4b5e3a4d9
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
e6174a2c85
Update more tests to the new EH scheme.
...
llvm-svn: 138894
2011-08-31 21:04:11 +00:00
Dan Gohman
56e1cef705
Constant pointers to objects don't need reference counting.
...
llvm-svn: 138242
2011-08-22 17:29:11 +00:00
Dan Gohman
bce94fded8
Make a few tests slightly more strict.
...
llvm-svn: 138241
2011-08-22 17:27:02 +00:00
Dan Gohman
b38940135b
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
02e737b08e
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
10a18d55ce
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
121302772d
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
b24a1d29cb
Tidy up these testcases to look more like real code does.
...
llvm-svn: 137085
2011-08-09 00:33:11 +00:00
Dan Gohman
6320f52ff4
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
00fa9634d5
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
d935e9c359
The ARC language-specific optimizer. Credit to Dan Gohman.
...
llvm-svn: 133108
2011-06-15 23:37:01 +00:00