@@ -63,6 +63,12 @@ struct State {
63
63
// / put in missing destroys.
64
64
SmallVectorImpl<SILBasicBlock *> *leakingBlocks;
65
65
66
+ // / The list of passed in consuming uses.
67
+ ArrayRef<BranchPropagatedUser> consumingUses;
68
+
69
+ // / The list of passed in non consuming uses.
70
+ ArrayRef<BranchPropagatedUser> nonConsumingUses;
71
+
66
72
// / The set of blocks with consuming uses.
67
73
SmallPtrSet<SILBasicBlock *, 8 > blocksWithConsumingUses;
68
74
@@ -80,16 +86,22 @@ struct State {
80
86
81
87
State (SILValue value, SmallPtrSetImpl<SILBasicBlock *> &visitedBlocks,
82
88
ErrorBehaviorKind errorBehavior,
83
- SmallVectorImpl<SILBasicBlock *> *leakingBlocks)
89
+ SmallVectorImpl<SILBasicBlock *> *leakingBlocks,
90
+ ArrayRef<BranchPropagatedUser> consumingUses,
91
+ ArrayRef<BranchPropagatedUser> nonConsumingUses)
84
92
: value(value), beginBlock(value->getParentBlock ()), error(errorBehavior),
85
- visitedBlocks(visitedBlocks), leakingBlocks(leakingBlocks) {}
93
+ visitedBlocks(visitedBlocks), leakingBlocks(leakingBlocks),
94
+ consumingUses(consumingUses), nonConsumingUses(nonConsumingUses) {}
86
95
87
96
State (SILBasicBlock *beginBlock,
88
97
SmallPtrSetImpl<SILBasicBlock *> &visitedBlocks,
89
98
ErrorBehaviorKind errorBehavior,
90
- SmallVectorImpl<SILBasicBlock *> *leakingBlocks)
99
+ SmallVectorImpl<SILBasicBlock *> *leakingBlocks,
100
+ ArrayRef<BranchPropagatedUser> consumingUses,
101
+ ArrayRef<BranchPropagatedUser> nonConsumingUses)
91
102
: value(), beginBlock(beginBlock), error(errorBehavior),
92
- visitedBlocks(visitedBlocks), leakingBlocks(leakingBlocks) {}
103
+ visitedBlocks(visitedBlocks), leakingBlocks(leakingBlocks),
104
+ consumingUses(consumingUses), nonConsumingUses(nonConsumingUses) {}
93
105
94
106
void initializeAllNonConsumingUses (
95
107
ArrayRef<BranchPropagatedUser> nonConsumingUsers);
@@ -124,6 +136,22 @@ struct State {
124
136
// / for validity. If this is a linear typed value, return true. Return false
125
137
// / otherwise.
126
138
void checkDataflowEndState (DeadEndBlocks &deBlocks);
139
+
140
+ void dumpConsumingUsers () const {
141
+ llvm::errs () << " Consuming Users:\n " ;
142
+ for (auto user : consumingUses) {
143
+ llvm::errs () << *user.getInst ();
144
+ }
145
+ llvm::errs () << " \n " ;
146
+ }
147
+
148
+ void dumpNonConsumingUsers () const {
149
+ llvm::errs () << " Non Consuming Users:\n " ;
150
+ for (auto user : nonConsumingUses) {
151
+ llvm::errs () << *user.getInst ();
152
+ }
153
+ llvm::errs () << " \n " ;
154
+ }
127
155
};
128
156
129
157
} // end anonymous namespace
@@ -224,7 +252,8 @@ void State::initializeConsumingUse(BranchPropagatedUser consumingUser,
224
252
llvm::errs () << " Value: N/A\n " ;
225
253
}
226
254
llvm::errs () << " User: " << *consumingUser << " Block: bb"
227
- << userBlock->getDebugID () << " \n\n " ;
255
+ << userBlock->getDebugID () << " \n " ;
256
+ dumpConsumingUsers ();
228
257
});
229
258
}
230
259
@@ -327,7 +356,8 @@ void State::checkPredsForDoubleConsume(BranchPropagatedUser consumingUser,
327
356
}
328
357
329
358
llvm::errs () << " User: " << *consumingUser << " Block: bb"
330
- << userBlock->getDebugID () << " \n\n " ;
359
+ << userBlock->getDebugID () << " \n " ;
360
+ dumpConsumingUsers ();
331
361
});
332
362
}
333
363
@@ -356,7 +386,8 @@ void State::checkPredsForDoubleConsume(SILBasicBlock *userBlock) {
356
386
llvm::errs () << " N/A. \n " ;
357
387
}
358
388
359
- llvm::errs () << " Block: bb" << userBlock->getDebugID () << " \n\n " ;
389
+ llvm::errs () << " Block: bb" << userBlock->getDebugID () << " \n " ;
390
+ dumpConsumingUsers ();
360
391
});
361
392
}
362
393
@@ -514,7 +545,8 @@ LinearLifetimeError LinearLifetimeChecker::checkValue(
514
545
SmallVectorImpl<SILBasicBlock *> *leakingBlocks) {
515
546
assert (!consumingUses.empty () && " Must have at least one consuming user?!" );
516
547
517
- State state (value, visitedBlocks, errorBehavior, leakingBlocks);
548
+ State state (value, visitedBlocks, errorBehavior, leakingBlocks, consumingUses,
549
+ nonConsumingUses);
518
550
519
551
// First add our non-consuming uses and their blocks to the
520
552
// blocksWithNonConsumingUses map. While we do this, if we have multiple uses
0 commit comments