Commit Graph

135 Commits

Author SHA1 Message Date
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
Mark Lacey
60261a74f0 Fix typo.
Swift SVN r21902
2014-09-12 07:51:12 +00:00
Manman Ren
3932a2439c [Devirtualizer] remove a hack that disables devirtualizing via specialized
conformance.

Revert r19137 and keep the testing case. Commit a fix that combines
substitutions from the specialized protocol conformance and substitutions from
the ApplyInst; then uses the full substitution list in substGenericArgs.

I had a small SIL testing case that runs "sil-opt -devirtualize", but due to
rdar://18120894, the testing case failed to work.

rdar://17440222

Performance -----
Before:
Totals,54,114129,114129,114129,0,0 (O)
Totals,54,81957,81957,81957,0,0 (Ounchecked)
Totals,54,83157,83157,83157,0,0 (run 2 of Ounchecked)

After:
Totals,54,109847,109847,109847,0,0 (O)
Totals,54,80301,80301,80301,0,0 (Ounchecked)


Swift SVN r21442
2014-08-25 18:33:26 +00:00
Manman Ren
31303ce50a NFC: remove unused codes.
Swift SVN r21439
2014-08-25 16:25:43 +00:00
Nadav Rotem
e858faf991 Rename method. NFC.
Swift SVN r21394
2014-08-22 00:19:56 +00:00
Mark Lacey
feae9cc517 Remove include of CallGraph.h since it is not needed.
Swift SVN r21392
2014-08-22 00:00:03 +00:00
Nadav Rotem
54458fb892 Enable access control based devirtualization.
Patch (mostly) by Jordan Rose.

rdar://17890078. 



Swift SVN r21139
2014-08-12 00:43:18 +00:00
Nadav Rotem
822f72c5d5 Revert "Devirtualize class methods based on access control."
There are still correctness problems when inlining across files.



Swift SVN r21032
2014-08-05 00:42:38 +00:00
Nadav Rotem
0499d24be2 Simplify the loop that finds the class member using getDeclaredTypeInContext. NFC.
Swift SVN r21031
2014-08-05 00:38:21 +00:00
Nadav Rotem
c66f460266 Devirtualize class methods based on access control.
Swift SVN r21030
2014-08-04 23:58:30 +00:00
Nadav Rotem
1fd257773d Refactor parts of the Devirtualizer. Rename methods and move the method
that seaches for point-of-construction for classes outside of the function that
does the devirtualization. Now we have a utility that devirtualizes a class
given a ClassDecl. NFC.



Swift SVN r20946
2014-08-02 05:33:16 +00:00
Nadav Rotem
5eebe943bc Fix a copy-and-paste mistake. Give the pass a real name. NFC.
Swift SVN r20945
2014-08-02 04:10:59 +00:00
Nadav Rotem
2ce50db8a8 When inserting an inline cache sink the class_method instruction next to its only use.
I did not observe and performance difference with this change.



Swift SVN r20914
2014-08-01 21:29:56 +00:00
Nadav Rotem
685bb84c15 Minor cleanup. NFC.
Swift SVN r20851
2014-07-31 21:22:17 +00:00
Nadav Rotem
1b980052b1 Cache the class hierarchy construction.
Before this commit we scanned the vtables every time we wanted to know who are the subclasses of a class. Now we scan the vtables just once.



Swift SVN r20847
2014-07-31 21:07:11 +00:00
Nadav Rotem
5d2627eff8 Document a function and cleanup debug message. NFC.
Swift SVN r20761
2014-07-30 16:30:40 +00:00
Nadav Rotem
4833d8351b PIC: Fix a bug in the cache size threshold and fix the docs. Thanks Greg.
Swift SVN r20746
2014-07-30 08:54:00 +00:00
Nadav Rotem
230547f71a PIC: when sinking the StrongRetain instruction use the bit-casted class reference.
This allows the ARC optimizer to remove the retain-release pair after inlining.



Swift SVN r20744
2014-07-30 08:44:13 +00:00
Nadav Rotem
0cb8bf0ab8 Implement polymorphic inline caches.
Swift SVN r20740
2014-07-30 07:43:47 +00:00
Nadav Rotem
d85414e90d Split the function into two smaller functions. NFC.
Swift SVN r20722
2014-07-29 23:40:36 +00:00
Nadav Rotem
0a248aa8b2 Rename method. NFC.
Swift SVN r20719
2014-07-29 23:25:33 +00:00
Nadav Rotem
e2f243b349 Add stats. NFC.
Swift SVN r20715
2014-07-29 23:20:08 +00:00
Nadav Rotem
4ccfdb6f89 Disable monomorphic inline caches for classes that are not at the bottom of the hierarchy. <2% improvments on DeltaBlue.
Swift SVN r20713
2014-07-29 23:07:22 +00:00
Nadav Rotem
cb1dc81308 Revert accidental commit.
Swift SVN r20711
2014-07-29 23:05:05 +00:00
Nadav Rotem
7faa5883df Add a basic Class Hierarchy Analysis. At this point it only lists classes that are inherited from in this module.
Swift SVN r20710
2014-07-29 23:01:01 +00:00