Commit Graph

38 Commits

Author SHA1 Message Date
Chris Lattner
79ed57f9f2 standardize naming of tuples and tuple patterns on "elements".
Previously some parts of the compiler referred to them as "fields",
and most referred to them as "elements".  Use the more generic 'elements'
nomenclature because that's what we refer to other things in the compiler
(e.g. the elements of a bracestmt).

At the same time, make the API better by providing "getElement" consistently
and using it, instead of getElements()[i].

NFC.



Swift SVN r26894
2015-04-02 20:23:49 +00:00
Nadav Rotem
d78b376d07 [passes] Replace the old invalidation lattice with a new invalidation scheme.
The old invalidation lattice was incorrect because changes to control flow could cause changes to the
call graph, so we've decided to change the way passes invalidate analysis.  In the new scheme, the lattice
is replaced with a list of traits that passes preserve or invalidate. The current traits are Calls and Branches.
Now, passes report which traits they preserve, which is the opposite of the previous implementation where
passes needed to report what they invalidate.

Node: I tried to limit the changes in this commit to mechanical changes to ease the review. I will cleanup some
of the code in a following commit.

Swift SVN r26449
2015-03-23 21:18:58 +00:00
Joe Groff
962a87f444 SIL: Rename address-only existential instructions to '{init,deinit,open}_existential_addr'.
For better consistency with other address-only instruction variants, and to open the door to new exciting existential representations (such as a refcounted boxed representation for ErrorType).

Swift SVN r25902
2015-03-09 23:55:31 +00:00
Joe Groff
041d7f57a1 PredictableMemOpt: Don't touch structs with unreferenceable storage.
We can't safely decompose them into elements because we don't have access to them all. Fixes rdar://problem/19870485.

Swift SVN r25368
2015-02-18 03:29:51 +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
Joe Groff
259dad38f2 PredictableMemOpt: Don't try to diagnose recursive value types.
They're invalid, and we don't want to blow the stack trying to decompose a type with infinite elements. Fixes rdar://problem/17920535.

Swift SVN r23775
2014-12-08 01:58:19 +00:00
Mark Lacey
4f6e4394b2 Silence a few of the release build warnings.
Swift SVN r23156
2014-11-07 03:39:54 +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
Mark Lacey
a4645627bd Fix <rdar://problem/17755462> Predictable memory opts removes refcount operation
Don't remove otherwise dead allocations if there are uses that are the
destinations of copy_addr initializations that are not also takes of the
source. Doing so removes the retain of the source of the copy_addr.

There were no diffs building the stdlib -O0 with this change.

Swift SVN r20368
2014-07-23 03:49:45 +00:00
Nadav Rotem
940d47323a Teach the optimizer not to split aggregates with unreferenced members such as unions or bitfields.
rdar://17555966



Swift SVN r19820
2014-07-10 19:53:12 +00:00
Chris Lattner
afea47b621 rename "destroy_value" to "release_value", part of rdar://15889208.
Swift SVN r15777
2014-04-02 05:33:52 +00:00
Chris Lattner
a0a65c0ea2 change the sil parser/printer to use retain_value instead of copy_value.
Swift SVN r15776
2014-04-02 05:22:41 +00:00
Chris Lattner
6540423613 rename CopyValueInst -> RetainValueInst. The .sil syntax
isn't changed yet.


Swift SVN r15775
2014-04-02 05:11:31 +00:00
Ted Kremenek
c87ac8167a Use SWIFT_FALLTHROUGH instead of [[clang::fallthrough]].
Swift SVN r15028
2014-03-14 05:15:05 +00:00
Ted Kremenek
39a368f0ec Add [[clang::fallthrough]] in obvious cases to satisfy -Wimplicit-fallthrough.
Swift SVN r15018
2014-03-14 00:34:25 +00:00
Chris Lattner
001c1890e5 put all the SIL*Transform classes in anonymous namespaces, there is
no need for their symbols to be exported out of their implementation
file.


Swift SVN r14714
2014-03-06 01:49:53 +00:00
Andrew Trick
0825258b80 SIL transforms should only invalidate when things change.
-sil-print-all shows a nice readable evolution now.

Oh yeah, and we don't unnecessarilly rerun passes.

Swift SVN r13677
2014-02-08 08:20:45 +00:00
Andrew Trick
731000b4cd Added -sil-print-all and -sil-verify-all options.
Swift SVN r13662
2014-02-07 23:07:11 +00:00
Nadav Rotem
27a1a63134 Remove unneeded empty virtual destructors.
Swift SVN r13599
2014-02-06 22:24:33 +00:00
Nadav Rotem
1ef0d157ca PassManager: Inject the function/module into the Transformation.
Now the pass does not need to know about the pass manager. We also don't have
runOnFunction or runOnModule anymore because the trnasformation knows
which module it is processing. The Pass itself knows how to invalidate the
analysis, based on the injected pass manager that is internal to the
transformation.

Now our DCE transformation looks like this:

class DCE : public SILModuleTransform {
  void run() {
    performSILDeadCodeElimination(getModule());
    invalidateAnalysis(SILAnalysis::InvalidationKind::All);
  }
};





Swift SVN r13598
2014-02-06 22:11:21 +00:00
Nadav Rotem
99b075c32a Rename SILFunctionTrans -> SILFunctionTransform
Swift SVN r13536
2014-02-06 01:32:10 +00:00
Nadav Rotem
f8c7b54d28 Delete the unused performXXX() functions.
Swift SVN r13531
2014-02-06 00:57:28 +00:00
Michael Gottesman
631f9326ab [PM] Change enum => enum class everywhere in the PM code. Additionally fix some typos.
Swift SVN r13507
2014-02-05 21:25:15 +00:00
Nadav Rotem
2de81bb74e white space.
Swift SVN r13504
2014-02-05 20:32:23 +00:00
Nadav Rotem
1df8e93bbb Convert the diagnostic methods into passes.
Swift SVN r13503
2014-02-05 20:30:49 +00:00
Chris Lattner
11d93d0f18 unindent switch body.
Swift SVN r13344
2014-02-03 06:57:03 +00:00
Michael Gottesman
71f33eef2c Convert the recent commits with DEBUG() => #ifndef NDEBUG. That is what they should really be using. I just had a thinko there.
Swift SVN r13279
2014-02-01 02:19:10 +00:00
Michael Gottesman
226a6f89ca Only verify functions when building in DEBUG mode.
Swift SVN r13276
2014-02-01 01:37:22 +00:00
Chris Lattner
09a73e82f1 fix rdar://15887292 - PredictableMemoryOptimizations crashes on load from init_existential
Swift SVN r12842
2014-01-23 02:29:09 +00:00
Nadav Rotem
a07aed9d1f Change errs() -> dbgs() in a few files.
Swift SVN r12572
2014-01-20 06:36:50 +00:00
Chris Lattner
3a970678a1 implement definite initialization enforcement for delegating class
initializers.


Swift SVN r11980
2014-01-07 05:31:33 +00:00
Nadav Rotem
d0c96e4eeb Implement a very very basic SIL Mem2Reg pass that promotes write-only and single-basicblock allocas.
This pass removes 1/4 of the allocas in the standard library.



Swift SVN r11189
2013-12-12 17:42:50 +00:00
Chris Lattner
7c41f9e2d7 more diagnostic QoI improvements, refer to properties, not ivars.
Swift SVN r11094
2013-12-10 21:29:04 +00:00
Chris Lattner
8a5d66dc9d Start improving "DI for init methods" diagnostics. New additions:
t.swift:10:5: error: instance variable 'self.y' not initialized at super.init call
    super.init()
    ^
<unknown>:0: note: variable defined here
t.swift:15:5: error: use of base object 'SomeClass' before super.init call initializes it
    x = 17 
    ^

instead of:

variable 'self.y' captured by a closure before being initialized

for each of them.  <unknown> is in the crosshairs next.



Swift SVN r11036
2013-12-09 21:37:39 +00:00
Michael Gottesman
4379283013 Remove inclusion of SILPasses/Passes.h into Subsystems.h and update all relevant files.
Swift SVN r10880
2013-12-05 19:58:21 +00:00
Chris Lattner
6fdb5f9ce1 introduce a new abstraction for handling the memory object being
analyzed, and use it as common currency between the element use
collector and its clients.  Element collection is about to become
more nuanced.  NFC.


Swift SVN r10781
2013-12-04 17:07:29 +00:00
Chris Lattner
8640266bf7 remove the RemoveDeadAddressingInstructions helper, in favor of
the more fully featured "recursivelyDeleteTriviallyDeadInstructions".


Swift SVN r10724
2013-12-02 01:47:53 +00:00
Chris Lattner
d2adddd34c Now that memopt is its own SIL pass, split it out to its own file. Now
the file sizes are more reasonable and better structured.


Swift SVN r10722
2013-12-02 01:40:21 +00:00