Commit Graph

125 Commits

Author SHA1 Message Date
Arnold Schwaighofer
0b12dd19e3 These casts are not rc identity preserving we can't strip them
rdar://18668900

Swift SVN r22804
2014-10-16 23:44:13 +00:00
Roman Levenstein
ed22906964 Add helper methods to strip upcasts. This is required for upcoming devirtualizer patches.
Swift SVN r22602
2014-10-08 13:09:05 +00:00
Arnold Schwaighofer
36ad6d2faa ValueBase: Add getParentBB api
Swift SVN r21925
2014-09-12 21:05:21 +00:00
Michael Gottesman
4609513593 Remove SILValue::stripRCIdentityPreservingArgs and teach all uses of that method to use the new RCIdentityAnalysis.
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
2014-09-11 22:29:31 +00:00
Michael Gottesman
4647eb9601 Create RCIdentityAnalysis a cache for stripRCIdentityPreservingOps.
The cache is needed to ensure we do not run into compile time problems once we
start looking through Phi Nodes.

The analysis is currently disabled and just returns
SILValue::stripRCIdentityPreservingOps. I am going to thread it through the rest
of the passes that use that call. Then I am going to hide
stripRCIdentityPreservingArgs. Finally post OzU, I am going to enable the pass.

rdar://18300069

Swift SVN r21891
2014-09-11 21:51:29 +00:00
Michael Gottesman
875fa02f98 Hide SILValue::stripSinglePredecessor{Args,RCIdentityPreservingArgs}.
These really should never have been exposed since they are internals to
SILValue.

Swift SVN r21868
2014-09-11 05:44:58 +00:00
Michael Gottesman
2b4d7f72a2 [g-arc-opts] Look through enum literal instructions.
The enum literal instruction has the same reference identity as its payload if
it has a payload.

<rdar://problem/18195085>

Swift SVN r21644
2014-09-02 16:03:11 +00:00
Michael Gottesman
ec7cc211cb [g-arc-opts] A struct_extract of the only non-trivial stored field of a struct is always a ref count identity preserving identity.
rdar://18189325

Swift SVN r21614
2014-08-31 18:08:30 +00:00
Michael Gottesman
fb04e9082b [g-arc-opts] unchecked_enum_data is always a ref count identity preserving operation, always strip them off.
Originally I was using the notion of layout compatible to define the notion of a
ref count identity preserving operation. This is too restrictive of a definition
since layout compatible implies that the operation does not change the memory
location being pointed at. On the other hand, we just care that the ref counts
are the same.

rdar://18189329

Swift SVN r21613
2014-08-31 18:08:29 +00:00
Michael Gottesman
ae0ff91ff3 Teach the various forms of stripping to ignore single predecessor args from br and cond_br.
This is effectively looking through a no-op. So it makes sense to always look
through them if we can.

<rdar://problem/18038959>

Swift SVN r21343
2014-08-21 05:16:45 +00:00
Michael Gottesman
b30b212d04 Remove the term non-PHI and instead use SinglePredecessor.
Swift SVN r21340
2014-08-21 04:13:27 +00:00
Michael Gottesman
73434aa4fa Rename SwitchEnumInst::getBBCase => getUniqueCaseForDestination.
This matches the name for SwitchEnumInst::getCaseDestination() and includes the word
'unique' so that the name self documents.

I also removed a local function doing the same work in SimplifyCFG and changed
its user to use getUniqueCaseForDestination instead.

Swift SVN r21339
2014-08-21 04:06:19 +00:00
Michael Gottesman
6d7ace6013 Make sure that when stripping non phi rc identity preserving args from switch enums, we only strip off switch enum inst if our BB is mapped to the first payloaded case of the enum.
Swift SVN r21336
2014-08-21 03:46:26 +00:00
Michael Gottesman
96ef9814f5 Change CondBranchInst::getArgForDestBB() so that it returns SILValue() if the TrueBB and the False BB equal and so that it takes the SILArgument instead of the index.
Swift SVN r21335
2014-08-21 03:45:35 +00:00
Michael Gottesman
87d1c91394 [g-arc-opts] Look through non phi rc identity preserving arguments.
rdar://18070340

Swift SVN r21329
2014-08-20 23:40:50 +00:00
Michael Gottesman
f3145119b9 Add SILValue::stripNonPHIArgs and SILValue::stripNonPHIRCIdentityPreservingArgs
for looking through SILArguments that are not PHIs in a load-store and ARC
optimizer context respectively.

Swift SVN r21328
2014-08-20 23:40:49 +00:00
Michael Gottesman
56d51ca9f1 [g-arc-opts] Teach the ARC optimizer how to strip off ref count equivalent operations such as casts and ref count identity preserving typed geps.
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
2014-08-15 22:47:57 +00:00
Mark Lacey
ab3e8aac22 Make SILValue::stripCasts see through UncheckedRefBitCastInst.
The ARC optimizer had a wrapper that handled this, but other uses of
SILValue::stripCasts could benefit as well.

Swift SVN r21153
2014-08-12 19:00:45 +00:00
Joe Groff
7d274e28a7 SIL: Add an unchecked_addr_cast instruction.
Cast an address to another address type without the silly address_to_pointer/pointer_to_address round trip.

Swift SVN r16743
2014-04-24 04:14:48 +00:00
Joe Groff
68f942117a SIL: Squash 'ref_to_native_object' and 'native_object_to_ref' into one 'unchecked_ref_cast' insn.
An unsafe cast from a base to a derived class isn't really all that different from one from Builtin.NativeObject to an arbitrary class, so relax this pair of instructions to allow an arbitrary bitcast. This only combines the instructions; it doesn't attempt to simplify any codegen that was emitting round-trip casts before yet.

Swift SVN r16736
2014-04-24 03:10:53 +00:00
John McCall
8681963bcb A couple of long-overdue renames.
Builtin.ObjectPointer -> Builtin.NativeObject
Builtin.ObjCPointer -> Builtin.UnknownObject

Swift SVN r16634
2014-04-22 00:17:08 +00:00
Mark Lacey
679077305f Revert "Assert rather than going into an infinite loop."
This reverts r16307, which is not really useful with r16303 in place.

Swift SVN r16336
2014-04-14 22:13:18 +00:00
Mark Lacey
570a158679 Assert rather than going into an infinite loop.
Swift SVN r16307
2014-04-14 07:57:39 +00:00
Joe Groff
855ea99063 SIL: Combine 'archetype_ref_to_super' and 'upcast'.
We were wantonly applying 'upcast' to archetypes in some cases, and really, that's OK, since these instructions do the same thing (and generic specialization could turn archetype_ref_to_super into upcast). Make everyone's life easier by folding archetype_to_super into upcast. Fixes <rdar://problem/16192324>.

Swift SVN r14496
2014-02-28 04:33:18 +00:00
Michael Gottesman
0f287562de There are more than a few methods in SIL.cpp for SILValue. Refactor SILValue's implementations into its own file SILValue.cpp.
Swift SVN r13445
2014-02-04 20:25:49 +00:00