Commit Graph

2601 Commits

Author SHA1 Message Date
Erik Eckstein
b3691c83a6 SimplifyCFG: fix crash if a branch argument is replaced with a SILValue with result number != 0
Fixes https://bugs.swift.org/browse/SR-329
rdar://problem/23969954
2015-12-21 10:08:36 -08:00
Xin Tong
5ce5a5ec4d Move to use SSAUpdater to generate the SILArgument when a location has a covering value,
i.e. multiple different values from predecessors

Previously, RLE is placing the SILArguments and branch edgevalues itself. This is probably
not as reliable/robust as using the SSAupdater.

RLE uses a single SSAupdater to create the SILArguments, this way previously created SILArguments
can be reused.

One test is created specifically for that so that we do not generate extraneous SILArguments.
2015-12-21 00:31:11 -08:00
Xin Tong
5d10f31b0e Add a condition on what the maximum of locations there are in a function for RLE to optimize
RLE is an iterative data flow. Functions with too many locations may take a long time for the
data flow to converge.

Once we move to a genset and killset for RLE. we should be able to lessen the condition a bit more.

I have observed no difference in # of redundant loads eliminated on the stdlib (currently we
eliminate 3862 redundant loads).
2015-12-20 22:42:49 -08:00
Xin Tong
ec83f8c661 Revert "Move to use SSAUpdater to generate the SILArgument when a location has a covering value,"
This reverts commit bc172647c7.

Caused a compiler crash on Linux.
2015-12-20 18:19:40 -08:00
Xin Tong
bc172647c7 Move to use SSAUpdater to generate the SILArgument when a location has a covering value,
i.e. multiple different values from predecessors

Previously, RLE is placing the SILArguments and branch edgevalues itself. This is probably
not as reliable/robust as using the SSAupdater.

RLE uses a single SSAupdater to create the SILArguments, this way previously created SILArguments
can be reused.

One test is created specifically for that so that we do not generate extraneous SILArguments.
2015-12-20 17:40:41 -08:00
Xin Tong
375bef1295 Minor comment fix in DeadObjectElimination.cpp 2015-12-20 14:23:20 -08:00
Xin Tong
a95e25c887 Refactor in DSE
1. Add some comments regarding how the pass builds and uses genset and killset
2. Merge some similar functions.
3. Rename DSEComputeKind to DSEKind.
4. Some other small comment changes.
2015-12-20 14:19:47 -08:00
Mark Lacey
faba6e56b7 Add a stand-alone generic specializer pass.
Begin unbundling devirtualization, specialization, and inlining by
recreating the stand-alone generic specializer pass.

I've added a use of the pass to the pipeline, but this is almost
certainly not going to be the final location of where it runs. It's
primarily there to ensure this code gets exercised.

Since this is running prior to inlining, it changes the order that some
functions are specialized in, which means differences in the order of
output of one of the tests (one which similarly changed when
devirtualization, specialization, and inlining were bundled together).
2015-12-18 14:08:56 -08:00
Xin Tong
cb94f5fdd1 Update some comments and remove dead code in dead store elimination 2015-12-18 10:18:36 -08:00
Xin Tong
4491d86dc3 Optimize how gen and kill sets are computed in dead store elimination. Existing tests ensure correctness 2015-12-18 09:50:48 -08:00
Erik Eckstein
ae6fa34645 EscapeAnalysis: some new and changed utility functions to be used by alias analysis and ARC analysis. 2015-12-18 08:02:18 -08:00
Dmitri Gribenko
6a66b3cff8 Merge pull request #561 from practicalswift/typos-again
[Typo] Replace PR#514-525 with one large PR
2015-12-18 03:37:02 -08:00
Erik Eckstein
11c8da8f21 SimplifyCFG: add an additional safety check before we try to convert parameters of ABI compatible functions.
This check should not trigger, at least with the current definition of what a convert_function may do.
But still it's a good idea to make the check to be on the safe side.
2015-12-16 14:18:58 -08:00
practicalswift
8ab8847684 Fix typos. 2015-12-16 22:09:32 +01:00
Nadav Rotem
341888cac5 Fix a typo in the assert message. 2015-12-16 10:42:26 -08:00
Nadav Rotem
698dec087e Fix a bug in the overflow removal pass.
We were comparing constraints to arithmetic operations with mismatching types.
2015-12-16 10:39:06 -08:00
Xin Tong
8a0543b49c Rename EnableLocalStoreDSE to DisableLocalStoreDSE and flip the condition 2015-12-15 14:59:08 -08:00
Xin Tong
0f938ef6bd Speculatively disable local dead store. It breaks a test case. It was enabled because TBAA is believed to have been fixed. 2015-12-15 14:55:20 -08:00
Xin Tong
f7cc000e7a Enable local dead store, i.e. a store to a local variable is dead if its not read before function exit. 2015-12-15 09:34:36 -08:00
Xin Tong
1254eaa69e Add the invalidated analysis in DSE 2015-12-15 08:39:31 -08:00
Michael Gottesman
f3c8c5a774 Create SILBasicBlock::getSuccessorBlocks().
This just runs a transform range on getSuccessor()'s ArrayRef<SILSuccessor> so
one does not need to always call Successor.getBB() when iterating over successor
blocks. Instead the transform range does that call for you.

I also updated some loops to use this new SILBasicBlock method to make sure that
the code is tested out by tests that are already in tree. All these places
should be functionally the same albeit a bit cleaner.
2015-12-15 00:36:56 -06:00
Arnold Schwaighofer
99ff2168a6 Add debug messages to loop unrolling and array value propagation 2015-12-14 12:03:42 -08:00
Arnold Schwaighofer
6662e7432a Reapply Add a pass to propagate constant array values to array subscript calls
This reverts commit 82ff59c0b9.

Original commit message:

This allows us to compile the function:

func valueArray() -> Int{
  var a = [1,2,3]
  var r = a[0] + a[1] + a[2]
  return r
}

Down to just a return of the value 6. And should eventually allow us to remove
the overhead of vararg calls.

rdar://19958821
2015-12-14 12:03:41 -08:00
Mark Lacey
0358592e07 Sort file names in SILOptimizer/Transforms/CMakeLists.txt. 2015-12-14 11:57:39 -08:00
Adrian Prantl
64cbec3805 Add SIL syntax for declaring debug variables.
Debug variable info may be attached to debug_value, debug_value_addr,
alloc_box, and alloc_stack instructions.

In order to write textual SIL -> SIL testcases that exercise the handling
of debug information by SIL passes, we need to make a couple of additions
to the textual SIL language. In memory, the debug information attached to
SIL instructions references information from the AST. If we want to create
debug info from parsing a textual .sil file, these bits need to be made
explicit.

Performance Notes: This is memory neutral for compilations from Swift
source code, because the variable name is still stored in the AST. For
compilations from textual source the variable name is stored in tail-
allocated memory following the SIL instruction that introduces the
variable.

<rdar://problem/22707128>
2015-12-14 10:29:50 -08:00
Roman Levenstein
cbcd008ac4 [sil-devirtualizer] Rename isClassWithUnboundGenericParameters and extend it to work with any nominal types 2015-12-14 10:11:46 -08:00
Erik Eckstein
0880ddd6c7 [ReleaseDevirtualizer] fix non-detriministic crash.
rdar://problem/23868367
2015-12-14 09:57:05 -08:00
practicalswift
c6e8459187 Fix typos. 2015-12-14 11:13:30 +01:00
Dmitri Gribenko
f957a68170 Merge pull request #513 from practicalswift/fix-typos-17
Fix typos (17 of 30)
2015-12-14 01:11:28 -08:00
Dmitri Gribenko
ac79855ebd Merge pull request #507 from practicalswift/fix-typos-11
Fix typos (11 of 30)
2015-12-14 01:05:49 -08:00
Dmitri Gribenko
23366f2001 Merge pull request #506 from practicalswift/fix-typos-10
Fix typos (10 of 30)
2015-12-13 20:17:38 -08:00
Dmitri Gribenko
7001cfa2e0 Merge pull request #503 from practicalswift/fix-typos-7
Fix typos (7 of 30)
2015-12-13 20:11:12 -08:00
Michael Gottesman
d94fa0a515 Merge pull request #501 from practicalswift/fix-typos-5
Fix typos (5 of 30)
2015-12-13 18:55:20 -06:00
Dmitri Gribenko
78a568b4bd Merge pull request #499 from practicalswift/fix-typos-3
Fix typos (3 of 30)
2015-12-13 16:20:07 -08:00
practicalswift
41c5b46791 Fix incorrect typo fix. 2015-12-14 00:50:41 +01:00
practicalswift
2c98764fdb Fix typo: invertion → inversion 2015-12-14 00:12:00 +01:00
practicalswift
a297b26278 Fix typo: invaliate → invalidate 2015-12-14 00:12:00 +01:00
practicalswift
163cb4a062 Fix typo: intefering → interfering 2015-12-14 00:11:58 +01:00
practicalswift
b4f2e5dfdf Fix typo: eliminater → eliminator 2015-12-14 00:11:40 +01:00
practicalswift
882d0b3e28 Fix typo: elimimate → eliminate 2015-12-14 00:11:39 +01:00
practicalswift
4d1b0567b6 Fix typo: contant → constant 2015-12-14 00:11:28 +01:00
practicalswift
ba61f44eb5 Fix typo: commutitively → commutatively 2015-12-14 00:11:24 +01:00
practicalswift
45cb275de0 Fix typo: avalable → available 2015-12-14 00:11:18 +01:00
practicalswift
2d9bad6935 Fix typo: anlayzed → analyzed 2015-12-13 23:56:41 +01:00
Xin Tong
3b62b2f15c Rename reduceWithValues to LSValue::reduce 2015-12-13 11:37:34 -08:00
Xin Tong
fb480e9990 Reorder a few header includes 2015-12-13 10:17:15 -08:00
Xin Tong
27b5a40359 Rename MemLocation to LSLocation and LoadStoreValue to LSValue 2015-12-13 10:02:45 -08:00
Xin Tong
642a555a6c Rename MemLocation.h to SILValueProjection.h 2015-12-13 09:31:56 -08:00
Xin Tong
6a5c8701c6 Create a common createExtract function used across DSE and RLE 2015-12-13 09:19:54 -08:00
Xin Tong
7559f2013d Implement a LoadStoreValue vault so that every basic block keeps an
unsigned index instead of the real LoadStoreValue in RLE
2015-12-13 09:10:32 -08:00