Commit Graph

172 Commits

Author SHA1 Message Date
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
Joe Groff
7bb68490a1 Text files end with newlines.
Swift SVN r13500
2014-02-05 20:23:32 +00:00
Nadav Rotem
baa1d1679a Teach some of the passes about the new PM.
Swift SVN r13494
2014-02-05 18:58:23 +00:00
Nadav Rotem
654ce61c8f Reapply r13275 in hope it won't break the build again.
CFG trampoline optimizations and cond_br optimization.



Swift SVN r13369
2014-02-03 21:34:58 +00:00
Michael Gottesman
6fa09aa153 Revert "Reapply the cfg trampoline optimization and add another cond_br optimization:"
This reverts commit r13275. Fixing the build.

Swift SVN r13280
2014-02-01 02:19:11 +00:00
Nadav Rotem
ca27474139 Reapply the cfg trampoline optimization and add another cond_br optimization:
Same target:

 cond_br %0, bb1(%1 : $Int64), bb2(%1 : $Int64)

And trampolines:

bb0(%0 : $Builtin.Int1, %1 : $Int64, %2 : $Int64):
  cond_br %0, bb1(%1 : $Int64), bb2(%2 : $Int64)

bb1(%3 : $Int64):
  br bb3(%3 : $Int64)

bb2(%4 : $Int64):
  br bb3(%4 : $Int64)





Swift SVN r13275
2014-02-01 01:32:27 +00:00
Jordan Rose
a610743064 Revert "Remove simple trampoline blocks."
This seems to break building the Foundation overlay.

This reverts r13242.

Swift SVN r13246
2014-01-31 19:58:01 +00:00
Nadav Rotem
4dfecb243e Remove simple trampoline blocks.
Like this one:

bb2(%A : $Int64):
  br bb3(%A : $Int64)



Swift SVN r13242
2014-01-31 19:38:46 +00:00
Nadav Rotem
9b19675fb9 SimplifyCFG: Don't drop the branch arguments when simplifying conditional branch into a non conditional branch.
Swift SVN r11990
2014-01-07 07:40:48 +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
Mark Lacey
0ec7617a2c Simplify enum and Int1 integer_literal instructions.
In cases like the one below, replace the integer_literal instructions
with the condition branching to the block that the instruction is in.

    cond_br %10, bb1, bb3

  bb1:
    %13 = integer_literal $Builtin.Int1, -1
    br bb2(%13 : $Builtin.Int1)

  bb3:
    %18 = integer_literal $Builtin.Int1, 0
    br bb2(%18 : $Builtin.Int1)

Similarly, for
    switch_enum %0 : $Bool, case #Bool.true!enumelt: bb1
  bb1:
    %1 = enum $Bool, #Bool.true!enumelt

  we'll replace the enum with %0.

Use this functionality from within the CFG simplification pass to
simplify basic block args in an attempt to expose opportunities for
further CFG simplification.

Swift SVN r9968
2013-11-05 19:11:45 +00:00
Chris Lattner
2909a0e129 teach simplifycfg to constant fold switch_enum instructions, now that
all the tuple stuff is out of the way.  This kicks in 600 times in the
stdlib and ends up shrinking the stdlib by 2500 lines (down to 53209).


Swift SVN r9903
2013-11-03 16:52:50 +00:00
Chris Lattner
40467f37dd refactor some code out into a new "simplifyAfterDroppingPredecessor"
function.  It isn't doing anything useful yet, but some day it will,
don't you doubt it.


Swift SVN r9863
2013-11-01 00:10:02 +00:00
Chris Lattner
4d75b589ca teach simplify-cfg to constant fold cond_br instructions. Jump
threading exposes these all over the place, so we need to clean
them up.  This cuts 2000 lines out of the SIL for the stdlib.


Swift SVN r9855
2013-10-31 22:19:36 +00:00
Chris Lattner
a329721668 implement a simple and intentionally limited jump threading optimization
in simplifycfg.  This is intentionally pretty simple, but already kicks in
827 times in the stdlib, and cuts 1000 lines of sil out of it.


Swift SVN r9853
2013-10-31 20:56:22 +00:00
Chris Lattner
03e7b756d0 teach simplify-cfg to merge blocks connected by an uncond branch, when
the dest has no other predecessors.  This fires 6926 times on the stdlib.


Swift SVN r9794
2013-10-30 16:48:59 +00:00
Chris Lattner
cd844ed08f run simplifycfg as part of performance optimizations (e.g. swift -O1 and above runs it).
It only has one trivial optimization that kicks in only 19 times in the stdlib, but its
progress.


Swift SVN r9792
2013-10-30 16:01:51 +00:00
Chris Lattner
681ad64db3 teach simplifycfg's dead block deletion to correctly handle blocks with
instructions that are used cross-block.


Swift SVN r9788
2013-10-30 14:23:51 +00:00
Chris Lattner
d5fd6a67e0 Sketch out a trivial start at a simplify-cfg pass with one optimization to delete
dead blocks (which happens to be incorrect).

Unlike the LLVM SimplifyCFG pass, this one will be worklist-based instead of 
iterative, avoiding needless iteration over the entire function when a small
local changes are being made.


Swift SVN r9756
2013-10-29 04:37:27 +00:00