Commit Graph

11224 Commits

Author SHA1 Message Date
Doug Gregor
824088a07d Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-17 15:50:24 -08:00
Xin Tong
aa9b052363 Fix an iterator invalidation bug in SSAupdater
I failed to create a test, but will check in a test in the context of
redundant load elimination, which will use the SSAupdater.
2015-12-17 15:50:20 -08:00
Arnold Schwaighofer
386dd0f171 COWArrayOpt: Handle patterns of 2d array accesses after more aggresive alias analysis
Make sure we handle a code pattern that we will encounter after Erik's upcoming
alias analysis changes.

rdar://23938778
2015-12-17 15:30:51 -08:00
Mark Lacey
90b45c4dd7 Extract method to run all function passes over a given function.
More small refactoring in the pass manager.
2015-12-17 14:57:30 -08:00
Mark Lacey
d770376981 Replace tabs with spaces.
Also run clang-format over the changed area.
2015-12-17 12:25:03 -08:00
Mark Lacey
fbb7abc7c6 Fix 80-column violations. 2015-12-17 12:25:03 -08:00
Max Moiseev
3fe0c60d7f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-17 11:00:02 -08:00
Nadav Rotem
e56bc1bf19 Merge pull request #624 from joemasilotti/looses-vs-loses
Fix grammar of variable
2015-12-17 10:24:25 -08:00
Joe Masilotti
5ea582cf35 Fix grammar of variable
Change variable name to match method signature of APFloat::convert

http://llvm.org/docs/doxygen/html/classllvm_1_1APFloat.html#a4fa2f1464bb4f645082d8aa0e0a9bc0e
2015-12-17 12:41:26 -05:00
Mark Lacey
bed0da6472 Typo: consequtive -> consecutive 2015-12-16 22:43:54 -08:00
Mark Lacey
3ed75f4fb0 Move the pass manager's function worklist into PassManager.
Make it a std::vector that reserves enough space based on the number of
functions in the initial bottom-up ordering.

This is the first step in making it possible for function passes to
notify the pass manager of new functions to process.
2015-12-16 21:30:33 -08:00
Michael Gottesman
f81b6694b3 Update the DEBUG_TYPE names of the various parts of ARC to match the new name of GlobalARCOpts, ARCSequenceOpts. 2015-12-16 21:32:05 -06:00
Dmitri Gribenko
9ecf7eea21 Merge pull request #610 from frootloops/patch-3
Fix some guidelines violations and typos
2015-12-16 18:15:42 -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
Arsen Gasparyan
65f336b849 Fix a typo 2015-12-17 00:57:52 +03:00
practicalswift
8ab8847684 Fix typos. 2015-12-16 22:09:32 +01:00
Nadav Rotem
7f9118f037 Move getAnalysis into the debug section (to fix a warning). NFC. 2015-12-16 10:43:00 -08: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
Doug Gregor
1ba7b5d98d Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-15 16:01:48 -08:00
Mark Lacey
226a825807 Simplify the pass manager execution logic.
Make it a bit more clear that we're alternating between collecting (and
then running) function passes, and running module passes. Removes some
duplication that was present.

Reapplies 9d4d3c8 with fixes for bisecting pass execution.
2015-12-15 15:17:53 -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
Mark Lacey
59544560d1 Revert "Simplify the pass manager execution logic."
This reverts commit 9d4d3c8055.

I forgot to finish up changes required to make -Xllvm
-sil-opt-pass-count continue working the way it did, so I'll back that
out until I have those changes as well.
2015-12-15 13:23:59 -08:00
Mark Lacey
9d4d3c8055 Simplify the pass manager execution logic.
Make it a bit more clear that we're alternating between collecting (and
then running) function passes, and running module passes. Removes some
duplication that was present.
2015-12-15 13:08:08 -08:00
Max Moiseev
2021dd5a4d Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-15 12:49:22 -08:00
Mark Lacey
a8fbc4722f Minor pass manager refactoring.
Extract the code related to running a module pass into a separate
function.
2015-12-15 10:25:38 -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
472efd46c6 [loop-region-analysis] Store the exiting regions from loops that we compute and used to just throw away.
I need this for loop-arc since I need to be able to analyze all "loop-exits"
when I just have the parent loop region. We are already computing this
information and throwing it away, so there should be no compile time impact.
2015-12-15 02:02:39 -06:00
Michael Gottesman
a3a329fffb Add some comments to LoopRegionAnalysis that explains a few methods in better detail. NFC. 2015-12-15 02:02:39 -06:00
Roman Levenstein
ee9a739f3c Stop "using namespace llvm"
This avoids ambiguities between llvm and swift types with the same name.
2015-12-14 23:40:14 -08:00
Michael Gottesman
c29236cc89 When sort/uniqueing exiting regions for processing, unique not by pointer value, but by ID. 2015-12-15 00:36:56 -06: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
Chris Lattner
fd465ff520 Merge pull request #526 from practicalswift/fix-typos-30
Fix typos (30 of 30)
2015-12-14 18:13:19 -08:00
Erik Eckstein
f316a301e6 [LICM] fix wrong aliasing checks for alloc_stack 2015-12-14 16:50:48 -08:00
Erik Eckstein
7d50b6abcf [ClosureSpecializer] use shared linkage for new functions.
This avoids unresolved-symbol errors in case the original function has external linkage.
2015-12-14 16:35:26 -08:00
Roman Levenstein
58221cd15a Make it clear to the compiler that we mean swift::LoadInst, not llvm::LoadInst here. 2015-12-14 13:25:53 -08:00
Roman Levenstein
3596805cf8 Fix formatting. NFC. 2015-12-14 13:09:08 -08:00
Max Moiseev
806be29941 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-14 12:05:35 -08:00
Arnold Schwaighofer
99ff2168a6 Add debug messages to loop unrolling and array value propagation 2015-12-14 12:03:42 -08:00
Arnold Schwaighofer
edf9ca06fc Unroll loops with known short trip count
This enables array value propagation in array literal loops like:

for e in [2,3,4] {
  r += e
}

Allowing us to completely get rid of the array.

rdar://19958821
SR-203
2015-12-14 12:03:42 -08:00
Arnold Schwaighofer
ba2de2d88d Use SILLoop::canDuplicate in the ArraySpecializer 2015-12-14 12:03:41 -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
e6442dc9b2 [sil-devirtualizer] Improve devirtualization of class_method instructions
Use ClassHierarchyAnalysis to check if a given method is effectively final, i.e. cannot be overridden.
This replaces the old approach based on using  isKnownFinal, which was weaker because it didn't use the ClassHierarchyAnalysis.
2015-12-14 10:11:47 -08:00
Roman Levenstein
ed38ce409c [sil-devirtualizer] Add a helper function to compute all subclasses of a given class.
The new function uses the ClassHierarchyAnalysis to do its job.
2015-12-14 10:11:47 -08:00
Roman Levenstein
fd0b383570 [sil-devirtualizer] Handle devirtualization of generic classes 2015-12-14 10:11:47 -08:00
Roman Levenstein
c909ff4cf2 [sil-devirtualizer] Improve getInstanceWithExactDynamicType
It is now able to cover some new cases where the instance is a parameter of a function. If it can be proven that the static type of instance cannot be derived, then it's static type is also a dynamic type of the instance.

The new functionality is not directly triggered in the current setup, because isKnownFinalMethod is currently invoked before it and subsumes this cases. But getInstanceWithExactDynamicType got this functionality anyways to be self-contained, so that it can be used in other contexts, where it is not invoked after isKnownFinalMethod.
2015-12-14 10:11:47 -08:00