Mark Lacey
10647fc13e
More clean-up and renaming in devirtualizer.
...
I will be moving some of this code into a utility next.
Swift SVN r25712
2015-03-03 06:32:58 +00:00
Mark Lacey
9b7f58fcd5
Whitespace clean-up.
...
Swift SVN r25674
2015-03-02 06:24:12 +00:00
Mark Lacey
56012f87f6
Mark a free function as static since it is only used within this file.
...
Swift SVN r25673
2015-03-02 06:08:15 +00:00
Mark Lacey
4518893a3e
Simplify witness devirtualization argument passing.
...
Rely on the type checker and SIL verification pass rather than checking
types explicitly before creating upcasts.
Swift SVN r25672
2015-03-02 05:54:04 +00:00
Mark Lacey
c0ef8dccb4
Update comments and simplify some code in the devirtualizer.
...
More prep for refactoring into utility functions that can be used
outside of the devirtualization pass.
Swift SVN r25671
2015-03-02 04:30:31 +00:00
Mark Lacey
7b77c87afa
Minor reformatting changes.
...
Swift SVN r25670
2015-03-02 04:30:28 +00:00
Mark Lacey
cd0dfd1c31
Convert bottom-exit-while-true loop to do-while.
...
Swift SVN r25669
2015-03-02 02:43:33 +00:00
Mark Lacey
c3e83c2625
Remove isClassDeclOracle.
...
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
2015-03-02 02:43:32 +00:00
Mark Lacey
82e74a3e10
Fix the comment for getClassFromConstructor.
...
The previous comment didn't seem to bear much resemblance to what the
function does.
Swift SVN r25667
2015-03-02 02:43:31 +00:00
Mark Lacey
023a4db47e
Rename function to make naming consistent.
...
Swift SVN r25666
2015-03-02 02:43:29 +00:00
Nadav Rotem
e7140012bf
Revert "Disable generic specialization in the devirtualizer ..."
...
The problem was with the testcase that failed verification and not in the devirtualizer.
This reverts commit r25586.
Swift SVN r25594
2015-02-27 05:14:08 +00:00
Nadav Rotem
3f4a5e8612
Disable generic specialization in the devirtualizer because it broke the build.
...
Swift SVN r25586
2015-02-27 02:04:05 +00:00
Nadav Rotem
2f167a37ca
Clean up the GenericSpecializer interface. NFC.
...
Swift SVN r25580
2015-02-27 00:53:10 +00:00
Nadav Rotem
b6077500e0
Enable generic specialization of devirtualized functions.
...
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
2015-02-27 00:32:07 +00:00
Nadav Rotem
be032a9bc1
Teach the devirtualizer to return the newly created call (to be optimized later).
...
Swift SVN r25571
2015-02-27 00:32:00 +00:00
Dmitri Hrybenko
845dd08048
Fix a warning: implicit conversion of nullptr constant to 'bool'
...
Swift SVN r25543
2015-02-26 06:53:10 +00:00
Roman Levenstein
5bcd4319b8
[sil-devirtualizer] Do not try to devirtualize calls where a class instance is of an unbound generic type.
...
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
2015-02-23 23:52:37 +00:00
Dmitri Hrybenko
61286f0260
Fix warnings produced by a newer version of Clang
...
Swift SVN r25257
2015-02-12 23:50:47 +00:00
Roman Levenstein
8cd35dd701
[sil-devirtualizer] Correctly handle methods whose return types differ in optionality from the overriden methods.
...
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
2015-01-28 00:57:28 +00:00
Mark Lacey
8e7639050c
Fix spelling in function name.
...
Swift SVN r24687
2015-01-23 18:04:05 +00:00
Mark Lacey
f6f73df230
Fix typo in statistic string.
...
Swift SVN r24686
2015-01-23 18:04:04 +00:00
Mark Lacey
4e335599a3
Better fix for 80 column violation.
...
Swift SVN r24626
2015-01-22 01:13:45 +00:00
Mark Lacey
680cd3cdae
Revert "Fix another 80 column violation."
...
As Jordan points out this isn't an ideal fix in this case.
This reverts commit r24621.
Swift SVN r24625
2015-01-22 01:13:43 +00:00
Mark Lacey
077a103d07
Fix another 80 column violation.
...
Swift SVN r24621
2015-01-22 00:44:28 +00:00
Mark Lacey
eebea42401
Fix 80 column violation.
...
Swift SVN r24620
2015-01-22 00:44:27 +00:00
Mark Lacey
7846a2b3d4
Create applies with the transparent bit set properly during devirtualization.
...
Fixes rdar://problem/19477863.
Again, no real perf diff here, probably because the next round of
inlining was already inlining these (most of the hits are on setters,
getters, etc. which tend to be quite small).
Having this fixed will be useful in a future where we do some trivial
devirtualization during inlining, in particular mandatory
inlining (rdar://problem/19418937).
Swift SVN r24491
2015-01-17 02:49:15 +00:00
Nadav Rotem
cbf5bf4b89
Fix an unused variable warning.
...
Swift SVN r24405
2015-01-13 23:55:36 +00:00
Dmitri Hrybenko
e4f8a1cc71
Finish renaming lookUpSILFunctionFromVTable into
...
lookUpFunctionFromVTable. Unbreaks the build.
Swift SVN r24270
2015-01-08 04:53:17 +00:00
Michael Gottesman
4b4c32a2b0
Fix build by updating function name.
...
Swift SVN r24269
2015-01-08 04:52:52 +00:00
Roman Levenstein
e8d6b2e17a
[sil-devirtualizer] Improve handling of generics during devirtualization.
...
This patch provides a more robust way to find proper substitutions for generic classes during devirtualization. It fixes test-cases which were resulting in a compiler crash before. New tests are added to the test-suite to avoid this in the future.
Swift SVN r24040
2014-12-19 22:05:37 +00:00
Michael Gottesman
93b92a8f9f
Add in Passes.def for metaprogramming with SILPassKinds.
...
This simplifies some code in SILOpt and SILPasses. The real reason to do it is
to use it to procedurally generate random pipelines.
Swift SVN r23996
2014-12-17 23:56:26 +00:00
Roman Levenstein
39af94d226
[sil-devirtualizer] The new implementation of witness method devirtualization.
...
The new simplified design was inspired by a discussion with Michael. Thanks!
This implementation is much simpler and smaller than the old one. The tests are extended to check for more complex cases.
Swift SVN r23909
2014-12-13 03:03:59 +00:00
Roman Levenstein
499e58c5b8
[sil-devirtualizer] Remove the old implementation of witness method devirtualization. It got too over-complicated and will be replaced by a new, much smaller and simpler implementation.
...
Swift SVN r23908
2014-12-13 03:03:58 +00:00
Roman Levenstein
9764bc2b1e
[sil-devirtualizer] Better handle corner-cases in devirtMethod, e.g. metatypes or class_methods invoked on methods with non-bound generic type parameters.
...
Swift SVN r23907
2014-12-13 03:03:57 +00:00
Roman Levenstein
839699df22
[sil-devirtualizer] Improve checks in upcast upcastArgument.
...
Swift SVN r23906
2014-12-13 03:03:57 +00:00
Roman Levenstein
0ca09bc581
[sil-devirtualizer] Minor stylistic changes based on the feedback from a ML. NFC.
...
Swift SVN r23905
2014-12-13 03:03:56 +00:00
Mark Lacey
4a74e94b40
Fix release build warnings about unused variables.
...
Swift SVN r23893
2014-12-12 20:05:30 +00:00
Roman Levenstein
47651de376
[sil-devirtualizer] Significantly improve devirtualization of inherited and specialized protocol conformances.
...
This patch improves handling of generic parameters and implements proper handling of metatypes, which were blocking correct devirtualization of inherited and specialized conformances. It enables a corresponding test, because all its blocking issues are resolved now.
Fixes rdar://17823742, rdar://17823746 and rdar://16847192
Swift SVN r23882
2014-12-12 03:58:45 +00:00
Dmitri Hrybenko
f6e926224e
Fix warnings about unused variables when assertions are turned off
...
Swift SVN r23641
2014-12-03 04:48:38 +00:00
Roman Levenstein
2601c4e506
[sil-devirtualizer] Support devirtualization of inherited conformances.
...
Remove XFAIL from a corresponding test and extend it to cover more test-cases.
rdar://17823742 and rdar://17823746
Swift SVN r23619
2014-12-02 21:00:44 +00:00
Michael Gottesman
1afc987739
Refactor the SILArgument API on SILBasicBlock so we can insert bb arguments anywhere in the argument list. Also clean up the API names so that they all match.
...
Swift SVN r23543
2014-11-22 00:24:40 +00:00
Adrian Prantl
c41b30299f
Audit all SILPasses to ensure that new instructions are never created
...
without a valid SILDebugScope. An assertion in IRGenSIL prevents future
optimizations from regressing in this regard.
Introducing SILBuilderWithScope and SILBuilderwithPostprocess to ease the
transition.
This patch is large, but mostly mechanical.
<rdar://problem/18494573> Swift: Debugger is not stopping at the set breakpoint
Swift SVN r22978
2014-10-28 01:49:11 +00:00
Erik Eckstein
ff6d22685c
Use SILModule::isWholeModule() to check for whole-module compilation in Devirtualizer
...
Swift SVN r22724
2014-10-14 08:38:50 +00:00
Roman Levenstein
9f88e125ff
Fix the assertion failure reported in rdar://18566121 by being more restrictive when stripping casts to obtain a static class of the instance.
...
rdar://18566121
Swift SVN r22603
2014-10-08 13:09:13 +00:00
Roman Levenstein
0a38068c7a
[sil-devirtualizer] Always try to devirtualize the invocation of a method from a static class of an instance, even if the default case cannot be devirtualized completely.
...
rdar://18463760
Swift SVN r22523
2014-10-04 11:48:13 +00:00
Roman Levenstein
88d8a2884f
[sil-devirtualizer] Devirtualize the "default" case (i.e. none of the checked_cast_br checks match the class) when performing speculative devirtualization, whenever it is possible.
...
rdar://17557364
Swift SVN r22522
2014-10-04 09:49:50 +00:00
Roman Levenstein
0d3402e35e
Fix for problems with compiling the DeltaBlue benchmark and add a corresponding test.
...
Swift SVN r22497
2014-10-03 16:24:15 +00:00
Joe Groff
3a606b9eb8
SIL: Drop the protocol_method instruction.
...
Swift SVN r22446
2014-10-01 23:35:41 +00:00
Roman Levenstein
beb7d947a8
Enable devirtualization even a method to be invoked is implemented by one of the superclasses.
...
rdar://18365683
Swift SVN r22438
2014-10-01 21:05:06 +00:00
Roman Levenstein
63346a0ded
Avoid changing the CFG if devirtualization of a method call is not possible due to unavailability of information about the implementation of this method.
...
Related to rdar://18507807
Swift SVN r22435
2014-10-01 20:05:12 +00:00