John McCall
a237239097
Add an optimizer-side test case for ARC bug <rdar://13195034>, fixed
...
in the frontend with @clang.arc.use.
llvm-svn: 177928
2013-03-25 22:09:52 +00:00
John McCall
20182ac0c7
Kill every call to @clang.arc.use in the ARC contract phase.
...
llvm-svn: 177769
2013-03-22 21:38:36 +00:00
Michael Gottesman
a8b60a4fda
Reduced dont-infinite-loop-during-block-escape-analysis.ll with bugpoint and moved it to retain-block-escape-analysis.ll.
...
*NOTE* I verified that the original bug behind
dont-infinite-loop-during-block-escape-analysis.ll occurs when using opt on
retain-block-escape-analysis.ll.
llvm-svn: 177240
2013-03-17 21:31:12 +00:00
Michael Gottesman
9782183126
The promised test case for r175939.
...
This test makes sure that the ObjCARC escape analysis looks at the uses of
instructions which copy the block pointer value by checking all four cases where
that can occur.
llvm-svn: 177232
2013-03-17 08:42:58 +00:00
Bill Wendling
a032374ea0
Use references to attribute groups on the call/invoke instructions.
...
Listing all of the attributes for the callee of a call/invoke instruction is way
too much and makes the IR unreadable. Use references to attributes instead.
llvm-svn: 175877
2013-02-22 09:09:42 +00:00
Bill Wendling
90bc19cd91
Modify the LLVM assembly output so that it uses references to represent function attributes.
...
This makes the LLVM assembly look better. E.g.:
define void @foo() #0 { ret void }
attributes #0 = { nounwind noinline ssp }
llvm-svn: 175605
2013-02-20 07:21:42 +00:00
Dmitri Gribenko
44ee2e7a23
Tests: rewrite 'opt ... %s' to 'opt ... < %s' so that opt does not emit a ModuleID
...
This is done to avoid odd test failures, like the one fixed in r171243.
llvm-svn: 173163
2013-01-22 14:39:21 +00:00
Michael Gottesman
469a465fa8
This test is only supposed to test that the objc-arc alias analysis
...
allows for gvn to perform certain optimizations. Thus the runline should
only contain -objc-arc-aa, not the full -objc-arc.
llvm-svn: 173126
2013-01-22 04:41:11 +00:00
Michael Gottesman
00dfc68c2d
Added test for r172599 which fixes bugzilla://14584,rdar://11744105.
...
llvm-svn: 172656
2013-01-16 21:07:18 +00:00
Michael Gottesman
c99ee6b336
Added bugzilla PR number to test case.
...
llvm-svn: 172369
2013-01-13 22:17:22 +00:00
Michael Gottesman
f15c0bb495
Fixed an infinite loop in the block escape in analysis in ObjCARC caused by 2x blocks each assigned a value via a phi-node causing each to depend on the other.
...
A test case is provided as well.
llvm-svn: 172368
2013-01-13 22:12:06 +00:00
Michael Gottesman
556ff61122
Fixed bug in ObjCARC where we were changing a call from objc_autoreleaseRV => objc_autorelease but were not updating the InstructionClass to IC_Autorelease.
...
llvm-svn: 172288
2013-01-12 01:25:19 +00:00
Michael Gottesman
c9656faf1e
Fixed a bug where we were tail calling objc_autorelease causing an object to not be placed into an autorelease pool.
...
The reason that this occurs is that tail calling objc_autorelease eventually
tail calls -[NSObject autorelease] which supports fast autorelease. This can
cause us to violate the semantic gaurantees of __autoreleasing variables that
assignment to an __autoreleasing variables always yields an object that is
placed into the innermost autorelease pool.
The fix included in this patch works by:
1. In the peephole optimization function OptimizeIndividualFunctions, always
remove tail call from objc_autorelease.
2. Whenever we convert to/from an objc_autorelease, set/unset the tail call
keyword as appropriate.
*NOTE* I also handled the case where objc_autorelease is converted in
OptimizeReturns to an autoreleaseRV which still violates the ARC semantics. I
will be removing that in a later patch and I wanted to make sure that the tree
is in a consistent state vis-a-vis ARC always.
Additionally some test cases are provided and all tests that have tail call marked
objc_autorelease keywords have been modified so that tail call has been removed.
*NOTE* One test fails due to a separate bug that I am going to commit soon. Thus
I marked the check line TMP: instead of CHECK: so make check does not fail.
llvm-svn: 172287
2013-01-12 01:25:15 +00:00
Dmitri Gribenko
56bf2e1830
Tests: rewrite 'opt ... %s' to 'opt ... < %s' so that opt does not emit a ModuleID
...
This is done to avoid odd test failures, like the one fixed in r171243.
llvm-svn: 171250
2012-12-30 02:33:22 +00:00
Dan Gohman
7c84dad80a
Detect overflow in the path count computation. rdar://12277446.
...
llvm-svn: 163739
2012-09-12 20:45:17 +00:00
Dan Gohman
df476e5e93
Make provenance checking conservative in cases when
...
pointers-to-strong-pointers may be in play. These can lead to retains and
releases happening in unstructured ways, foiling the optimizer. This fixes
rdar://12150909.
llvm-svn: 163180
2012-09-04 23:16:20 +00:00
Benjamin Kramer
2f47a3fb07
Fix broken check lines.
...
I really need to find a way to automate this, but I can't come up with a regex
that has no false positives while handling tricky cases like custom check
prefixes.
llvm-svn: 162097
2012-08-17 12:28:26 +00:00
Dan Gohman
f64ff8ed3a
An objc_retain can serve as a may-use for a different pointer.
...
rdar://11931823.
llvm-svn: 160637
2012-07-23 19:27:31 +00:00
Dan Gohman
5f725cd196
Fix the objc_autoreleasedReturnValue optimization code to locate
...
the call correctly even in the case where it is an invoke. This
fixes rdar://11714057.
llvm-svn: 159157
2012-06-25 19:47:37 +00:00
Dan Gohman
14862c3141
Fix replacing all the users of objc weak runtime routines
...
when deleting them. rdar://11434915.
llvm-svn: 157080
2012-05-18 22:17:29 +00:00
Dan Gohman
f8b19d09ba
Fix the objc_storeStrong recognizer to stop before walking off the
...
end of a basic block if there's no store.
llvm-svn: 156520
2012-05-09 23:08:33 +00:00
Filipe Cabecinhas
5c43305383
Fixed a typo
...
llvm-svn: 156471
2012-05-09 14:43:50 +00:00
Dan Gohman
61708d37d6
Fix objc_storeStrong pattern matching to catch a potential use of the
...
old value after the store but before it is released.
This fixes rdar:/11116986.
llvm-svn: 156442
2012-05-08 23:34:08 +00:00
Dan Gohman
26aa827461
Avoid a bug in the path count computation, preventing an infinite
...
loop repeatedlt making the same change. This is for rdar://11256239.
llvm-svn: 155160
2012-04-19 21:50:46 +00:00
Dan Gohman
e1e352af2b
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
de8d2c446b
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
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