22
22
#include " swift/SIL/Dominance.h"
23
23
#include " swift/SIL/SILBuilder.h"
24
24
#include " swift/SIL/SILDebugScope.h"
25
- #include " swift/SIL/SILOpenedArchetypesTracker.h"
26
25
#include " swift/SIL/SILVisitor.h"
27
26
28
27
namespace swift {
@@ -48,7 +47,6 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
48
47
SILBuilder Builder;
49
48
DominanceInfo *DomTree = nullptr ;
50
49
TypeSubstitutionMap OpenedExistentialSubs;
51
- SILOpenedArchetypesTracker OpenedArchetypesTracker;
52
50
53
51
// The old-to-new value map.
54
52
llvm::DenseMap<SILValue, SILValue> ValueMap;
@@ -74,21 +72,10 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
74
72
public:
75
73
using SILInstructionVisitor<ImplClass>::asImpl;
76
74
77
- explicit SILCloner (SILFunction &F,
78
- SILOpenedArchetypesTracker &OpenedArchetypesTracker,
79
- DominanceInfo *DT = nullptr )
80
- : Builder(F), DomTree(DT),
81
- OpenedArchetypesTracker(OpenedArchetypesTracker) {
82
- Builder.setOpenedArchetypesTracker (&OpenedArchetypesTracker);
83
- }
84
-
85
75
explicit SILCloner (SILFunction &F, DominanceInfo *DT = nullptr )
86
- : Builder(F), DomTree(DT), OpenedArchetypesTracker(&F) {
87
- Builder.setOpenedArchetypesTracker (&OpenedArchetypesTracker);
88
- }
76
+ : Builder(F), DomTree(DT) {}
89
77
90
- explicit SILCloner (SILGlobalVariable *GlobVar)
91
- : Builder(GlobVar), OpenedArchetypesTracker(nullptr ) {}
78
+ explicit SILCloner (SILGlobalVariable *GlobVar) : Builder(GlobVar) {}
92
79
93
80
void clearClonerState () {
94
81
ValueMap.clear ();
@@ -385,15 +372,6 @@ class SILCloner : protected SILInstructionVisitor<ImplClass> {
385
372
private:
386
373
// / MARK: SILCloner implementation details hidden from CRTP extensions.
387
374
388
- // / SILVisitor CRTP callback. Preprocess any instruction before cloning.
389
- void beforeVisit (SILInstruction *Orig) {
390
- // Update the set of available opened archetypes with the opened
391
- // archetypes used by the current instruction.
392
- auto TypeDependentOperands = Orig->getTypeDependentOperands ();
393
- Builder.getOpenedArchetypes ().addOpenedArchetypeOperands (
394
- TypeDependentOperands);
395
- }
396
-
397
375
void clonePhiArgs (SILBasicBlock *oldBB);
398
376
399
377
void visitBlocksDepthFirst (SILBasicBlock *StartBB);
@@ -418,7 +396,6 @@ class SILBuilderWithPostProcess : public SILBuilder {
418
396
{
419
397
setInsertionPoint (SC.getBuilder ().getInsertionBB (),
420
398
SC.getBuilder ().getInsertionPoint ());
421
- setOpenedArchetypesTracker (SC.getBuilder ().getOpenedArchetypesTracker ());
422
399
}
423
400
424
401
~SILBuilderWithPostProcess () {
@@ -437,27 +414,9 @@ class SILClonerWithScopes : public SILCloner<ImplClass> {
437
414
friend class SILCloner <ImplClass>;
438
415
public:
439
416
SILClonerWithScopes (SILFunction &To,
440
- SILOpenedArchetypesTracker &OpenedArchetypesTracker,
441
417
DominanceInfo *DT = nullptr ,
442
418
bool Disable = false )
443
- : SILCloner<ImplClass>(To, OpenedArchetypesTracker, DT) {
444
-
445
- // We only want to do this when we generate cloned functions, not
446
- // when we inline.
447
-
448
- // FIXME: This is due to having TypeSubstCloner inherit from
449
- // SILClonerWithScopes, and having TypeSubstCloner be used
450
- // both by passes that clone whole functions and ones that
451
- // inline functions.
452
- if (Disable)
453
- return ;
454
-
455
- scopeCloner.reset (new ScopeCloner (To));
456
- }
457
-
458
- SILClonerWithScopes (SILFunction &To,
459
- bool Disable = false )
460
- : SILCloner<ImplClass>(To) {
419
+ : SILCloner<ImplClass>(To, DT) {
461
420
462
421
// We only want to do this when we generate cloned functions, not
463
422
// when we inline.
@@ -472,7 +431,6 @@ class SILClonerWithScopes : public SILCloner<ImplClass> {
472
431
scopeCloner.reset (new ScopeCloner (To));
473
432
}
474
433
475
-
476
434
private:
477
435
std::unique_ptr<ScopeCloner> scopeCloner;
478
436
protected:
@@ -684,9 +642,7 @@ void SILCloner<ImplClass>::visitBlocksDepthFirst(SILBasicBlock *startBB) {
684
642
if (BB != startBB)
685
643
clonePhiArgs (BB);
686
644
687
- // Non-terminating instructions are cloned in the first preorder walk so
688
- // that all opened existentials are registered with OpenedArchetypesTracker
689
- // before phi argument type substitution in successors.
645
+ // Non-terminating instructions are cloned in the first preorder walk.
690
646
getBuilder ().setInsertionPoint (BBMap[BB]);
691
647
asImpl ().visitInstructionsInBlock (BB);
692
648
0 commit comments