Commit Graph

18 Commits

Author SHA1 Message Date
Andrew Trick
61d2c0166b Make SILPasses (ARC & Pin removal) aware of IsUniqueInst.
Swift SVN r27888
2015-04-28 22:54:25 +00:00
Erik Eckstein
78a3572fa4 Rename NoDTC to NoTypeCheck. NFC.
Swift SVN r26973
2015-04-04 08:24:59 +00:00
Erik Eckstein
2f971c22cb re-apply r26871: stdlib: Do the Array fast-path check with a single array property call.
Changes compared to the original version:
I fixed the 2 bugs and added a test for the so far undetected missing range check bug.
To keep the SIL simple (4 basic blocks for arr[x]) I extracted the slow path for getElement into a
non-inlinable function.
On the other hand I inlined _typeCheck into the slow-path function.
This speeds up NSArray accesses because now only a single objectAtIndex is required for both
type checking and element retrieving.

Update on performance: DeltaBlue is now only 12% better (and not 25%). I suspect this is because
now Arnold's tail duplication cannot detect the ObjC call in the slow path.



Swift SVN r26935
2015-04-03 06:48:25 +00:00
Ted Kremenek
69a12dfcb8 Revert "stdlib: Do the Array fast-path check with a single array property call."
This was causing test '1_stdlib/ArrayTraps.swift.gyb' to fail.

Swift SVN r26872
2015-04-02 14:47:19 +00:00
Erik Eckstein
834645a901 stdlib: Do the Array fast-path check with a single array property call.
Now that we can check isNative and NoDTC (no deffered type check needed) with a single bit-mask operation,
it makes sense to have a single array property call for it.
I replaced the the semantics call array.props.needsElementTypeCheck with array.props.isNativeNoDTC,
which is the combination of isNative && !needsElementTypeCheck. I kept array.props.isNative, which is not used for now,
but might be useful in the future, e.g. for array operations which don't care about type checks.

The optimized SIL for a class array access arr[i] now contains the minimum of 4 basic blocks.
PerfTests show +25% for DeltaBlue and some improvemements for -Onone.



Swift SVN r26871
2015-04-02 14:10:54 +00:00
Michael Gottesman
cb1bd848dc Sort some headers and change the ordering to match LLVM style. NFC.
Swift SVN r26775
2015-03-31 19:59:01 +00:00
Michael Gottesman
74777a6c3a [remove-pin] Teach remove pin how to recognize a safe guaranteed array semantic call sequence.
Given a strong_pin for which we have not yet seen a strong_unpin, a safe
guaranteed call sequence is of the following form:

retain(x)
call f(@guaranteed x)
release(x)

where f is an array semantic call that we know does not touch globals and thus
are known to not change ref counts.

rdar://20305817

Swift SVN r26662
2015-03-28 00:43:47 +00:00
Nadav Rotem
50803a7653 Create FunctionAnalysisBase to handle the boiler plate of caching and invalidating function specific analysis.
Swift SVN r26642
2015-03-27 20:54:22 +00:00
Nadav Rotem
f0fa502d56 Split the RCIdentityAnalysis analysis to allow per-function invalidation.
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
2015-03-27 16:55:36 +00:00
Michael Gottesman
254c784c94 [+0 self][pin removal] Teach pinremoval how to use RCIdentityAnalysis when removing pins.
Previously, we were being very conservative and were not trying to look through
any RCId uses. Now we understand how to look through RCIdentical instructions to
pair a pin and unpin. We also understand how to use the new getRCUses API on
RCIdentityAnalysis to get all uses of a value, looking through RCIdentical
instructions.

I also added some code to COWArrayOpts to teach it how to look through enum insts (which I needed).

Additionally I got stuck and added support for automatic indentation in Debug
statements. This is better than having to indent by hand every time.

There were no significant perf changes since this code was not being emitted by
the frontend. But without this +0 self causes COW to break.

rdar://20267677

Swift SVN r26529
2015-03-25 06:21:11 +00:00
Nadav Rotem
d78b376d07 [passes] Replace the old invalidation lattice with a new invalidation scheme.
The old invalidation lattice was incorrect because changes to control flow could cause changes to the
call graph, so we've decided to change the way passes invalidate analysis.  In the new scheme, the lattice
is replaced with a list of traits that passes preserve or invalidate. The current traits are Calls and Branches.
Now, passes report which traits they preserve, which is the opposite of the previous implementation where
passes needed to report what they invalidate.

Node: I tried to limit the changes in this commit to mechanical changes to ease the review. I will cleanup some
of the code in a following commit.

Swift SVN r26449
2015-03-23 21:18:58 +00:00
Arnold Schwaighofer
aa24e126e4 ArraySemantic: Move to its own file in SILAnalysis
I want to use it in ARCAnalysis.

Swift SVN r25924
2015-03-10 15:20:20 +00:00
Arnold Schwaighofer
e27a039406 RemovePins: Don't remove a pin/unpin pair accross a call that may read the pin
flag

This is more of a theoretical concern. But better be documented and checked then
sorry.

Swift SVN r25888
2015-03-09 17:29:07 +00:00
Michael Gottesman
38a0c69fc1 Rename some arc routines to use may instead of can as a prefix to match AliasAnalysis more closely.
Swift SVN r24509
2015-01-19 10:03:06 +00:00
Michael Gottesman
39817d5fd8 Remove arc namespace.
Swift SVN r24500
2015-01-19 00:10:48 +00:00
Arnold Schwaighofer
4d3e443c3a RemovePin: Array semantic functions are generally safe
Array semantics functions don't release the array in unexpected ways.

Swift SVN r24456
2015-01-15 22:44:37 +00:00
Arnold Schwaighofer
fdc1423557 RemovePin: Remember when the pass changes stuff
We do need to set the 'Changed' variable when we have removed pins such that we
can invalidate analysis at the end of the pass run.

Swift SVN r24455
2015-01-15 22:44:36 +00:00
Arnold Schwaighofer
1e482be681 Add a pass to remove trivial pin/unpin pairs.
This pass removes pin/unpin pairs that are not interleaved by a may-release of
the pin's operand.

This will be needed when we turn on John's work on safe array accessors.

Swift SVN r24434
2015-01-15 00:48:59 +00:00