|
32 | 32 | #include "swift/SILOptimizer/Utils/CastOptimizer.h"
|
33 | 33 | #include "swift/SILOptimizer/Utils/Existential.h"
|
34 | 34 | #include "swift/SILOptimizer/Utils/InstOptUtils.h"
|
| 35 | +#include "swift/SILOptimizer/Utils/OwnershipOptUtils.h" |
35 | 36 | #include "llvm/ADT/DenseMap.h"
|
36 | 37 | #include "llvm/ADT/SmallVector.h"
|
37 | 38 |
|
@@ -87,6 +88,20 @@ class SILCombiner :
|
87 | 88 | /// Centralized InstModCallback that we use for certain utility methods.
|
88 | 89 | InstModCallbacks instModCallbacks;
|
89 | 90 |
|
| 91 | + /// Dead end blocks cache. SILCombine is already not allowed to mess with CFG |
| 92 | + /// edges so it is safe to use this here. |
| 93 | + DeadEndBlocks deBlocks; |
| 94 | + |
| 95 | + /// A utility struct used by OwnershipFixupContext to map sets of partially |
| 96 | + /// post-dominating blocks to a full jointly post-dominating set. |
| 97 | + JointPostDominanceSetComputer jPostDomComputer; |
| 98 | + |
| 99 | + /// A utility that we use to perform erase+RAUW that fixes up ownership for us |
| 100 | + /// afterwards by lifetime extending/copy values as appropriate. We rely on |
| 101 | + /// later optimizations to chew through this traffic. This ensures we can use |
| 102 | + /// one code base for both OSSA and non-OSSA. |
| 103 | + OwnershipFixupContext ownershipRAUWHelper; |
| 104 | + |
90 | 105 | public:
|
91 | 106 | SILCombiner(SILOptFunctionBuilder &FuncBuilder, SILBuilder &B,
|
92 | 107 | AliasAnalysis *AA, DominanceAnalysis *DA,
|
@@ -117,7 +132,9 @@ class SILCombiner :
|
117 | 132 | [&](Operand *use, SILValue newValue) {
|
118 | 133 | use->set(newValue);
|
119 | 134 | Worklist.add(use->getUser());
|
120 |
| - }) {} |
| 135 | + }), |
| 136 | + deBlocks(&B.getFunction()), jPostDomComputer(deBlocks), |
| 137 | + ownershipRAUWHelper(instModCallbacks, deBlocks, jPostDomComputer) {} |
121 | 138 |
|
122 | 139 | bool runOnFunction(SILFunction &F);
|
123 | 140 |
|
|
0 commit comments