This allows for the state transition kind caused by an instruction to change how
we process it. It also decouples this effect from the actual CFG visiting code.
This will give us the flexibility to teach the ARC optimizer in a clean way
about many more types of instructions.
Swift SVN r26901
Perf Results:
RIGHT - Before (ms)
LEFT - After (ms)
TITLE LEFT RIGHT RIGHT/LEFT
InsertionSort 103721.00 110326.00 1.06
NSXMLParser 27031.00 29763.00 1.10
rdar://20355793
Swift SVN r26784
Before the change the RCIdentityAnalysis kept a single map that contained
the module's RC information. When function passes needed to invalidate the
analysis they had to clear the RC information for the entire module. The
problem was mitigated by the fact that we process one function at a time, and
we start processing a new function less frequently.
II adopted the DominanceAnalysis structure. We should probably implement
this functionality as CRTP.
Swift SVN r26636
An RCStateTransition is (you guessed it) a transition in the state
of an RCIdentity. It abstracts operations such as:
1. The introduction of a new incremented RCID by an argument (and in
the future
an @owned return value).
2. Strong increment of an RC.
3. Strong decrement of an RC.
I will use this to move pin_removal into the ARC optimizer and will
open up the ARC optimizer to being able to match up unowned values in the
future. It additionally allows me to deduplicate code from
{TopDown,BottomUp}RefCountState into RefCountState, RCStateTransition.
Swift SVN r26608
TerminatorInsts. Now you can walk over the successor list of a terminator
and actually modify the SILSuccessor directly, allowing better CFG
transformations. NFC.
Swift SVN r26140
optimizer freezing releases in the epilogue of functions that match to
SILArguments. This allows us to treat all such SILArguments throughout the
entire function as having a post dominating release.
<rdar://problem/18923030>
Swift SVN r23253
This reduces the number of retain, release operations in the dylib from 38512 to
16041. That is a reduction of 60%. Most of the code paths affected by this were
in the cocoa part of the stdlib so when I measured the perf test suite I did not
see a huge boost in perf.
rdar://18327670
Swift SVN r21934
Currently, the pass just calls a local version of that function. After OzU, I
will enable the full pass (which is currently disabled behind a flag).
Swift SVN r21894
Adds an ignore pattern for cond_fail unreachable blocks. These can happen
because of code that does a preconditionFailure on a branch.
if cond {
preconditionFailure("Must not happen")
}
No performance impact measure on the perf test suite.
Swift SVN r21334
Now that the ARC optimizer does not rely on stripCasts I also added
unchecked_trivial_bit_cast to stripCasts.
This and r21164 give the following speedups > 10%:
Ary 55.95%
MatMul 36.71%
Ary2 34.97%
Richard 32.08%
PrimeNum 15.87%
<rdar://problem/17456455>
Swift SVN r21240
This was a sanity check that I through in that makes sure that we do not
try to merge together an @owned argument we are tracking with an
instruction.
rdar://17634697
Swift SVN r19967
This will be cleaned up for sure at the LLVM level if we do not reach it
at the SIL level implying that this is safe.
<rdar://problem/17419974>
Swift SVN r19262
This enables us to handle significantly crazier control flow without
needing to worry about control dependency issues relating to different
groups of insertion points potentially not being control dependent which
can cause incorrect behavior in the optimizer.
Swift SVN r18861
I wish we had the ability to specify a log grouping, so I could log all
of ARC opts or just a specific part of it. Sadly we don't have that now
so I am going to centralize them under the same flag.
Swift SVN r18820
These trap BBs are pattern matched very strictly, i.e. only BBs of the
following form are matched:
bbN:
%_ = builtin_function_ref "int_trap"
apply %_
unreachable
Such BBs can be ignored safely for ARC purposes. This allows us to
handle -O3 code in the ARC optimizer significantly more effectively by
enabling us to handle many more types of check failures.
For instance we can now remove retains, releases in the following code:
bb0:
strong_retain %0
cond_br _, bb1, bb2
bb1:
strong_release %0
...
bb2:
%_ = builtin_function_ref "int_trap"
apply %_
unreachable
rdar://17212610
Swift SVN r18817
Also fixed a small bug related to how we handle arguments. We were not
clearing the state of the argument when we saw a potential decrement of
the argument.
<rdar://problem/17013194>
Swift SVN r18706