This reverts commit r25946, reinstating r25944.
This had been preemptively reverted fearing it might have broken
test/SILPasses/devirt_value_metatypes.swift, but that turned out to not
have been the case.
Swift SVN r25959
This reverts commit r25947, reinstating r25943 with fixes.
This had been preemptively reverted fearing it might have broken
test/SILPasses/devirt_value_metatypes.swift, which it did. One of the
early exits that was hoisted should not have been moved.
I plan on another clean-up for that particular early exit in a
forthcoming commit.
Swift SVN r25958
This reverts commit r25948, reinstating r25942.
This had been preemptively reverted fearing it might have broken
test/SILPasses/devirt_value_metatypes.swift, but that turned out to not
have been the case.
Swift SVN r25957
This reverts commit r25949, reinstating r25941.
This had been preemptively reverted fearing it might have broken
test/SILPasses/devirt_value_metatypes.swift, but that turned out to not
have been the case.
Swift SVN r25956
It's clear from the surrounding code and our type system that these
checks can never fail. To ensure I wasn't overlooking something I added
asserts to this effect and ran the test suite. I remove the asserts
because they feel like clutter, but if anyone feels strongly I can add
them back.
Swift SVN r25944
Dispatching on value_metatype, which happens in cases like obj.dynamicType.method(), was broken.
Fix it and add a corresponding test-case.
Swift SVN r25892
No functional change here, and this is not in its final form. This is
just cut/paste/tweak to split the code apart in a first reasonable form.
Swift SVN r25769
Decouple devirtualizeClassMethod into an analysis part and a part that performs a real transformation.
This allows for early bail outs when trying to devirtualize a class_method call and thus avoids creating a duplicate class_method call invocation, which happened before in certain rare cases.
Swift SVN r25717
The only use of this was not terribly useful as an early-out since we
immediately test for two of the three cases.
At some point we can extend the code to actually walk back through
projections, but until then this just seems like noise.
Swift SVN r25668
We currently run the generic specialize after the devirtualizer because
devirtualization can unblock generic specialization. This patch saves the
newly created ApplyInsts and attempts to specialize only them.
Swift SVN r25576
Devirtualizer should not even try to devirt calls where a class instance is of an unbound generic type, because there is no support for it yet.
This fixes rdar://19912272
Swift SVN r25491
In case when a base method and an overriding derived method differ in the optionality of the return type, devirt should perform the required wrapping after devirtualizing the class_method call.
rdar://19619832
Swift SVN r24768