File tree Expand file tree Collapse file tree 3 files changed +5
-9
lines changed
lib/SILOptimizer/SILCombiner Expand file tree Collapse file tree 3 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ bool SILCombiner::trySinkOwnedForwardingInst(SingleValueInstruction *svi) {
172
172
svi->moveBefore (consumingUser);
173
173
MadeChange = true ;
174
174
175
- // NOTE: We return nullptr here so that our caller doesn't delete the
175
+ // NOTE: We return false here so that our caller doesn't delete the
176
176
// instruction and instead tries to simplify it.
177
177
return false ;
178
178
}
Original file line number Diff line number Diff line change @@ -353,10 +353,6 @@ class SILCombiner :
353
353
bool optimizeIdentityCastComposition (ApplyInst *FInverse,
354
354
StringRef FInverseName, StringRef FName);
355
355
356
- // / Let \p user and \p value be two forwarding single value instructions with
357
- // / the property that \p user, through potentially a chain of forwarding
358
- // / instructions.
359
- // /
360
356
// / Let \p user and \p value be two forwarding single value instructions with
361
357
// / the property that \p value is the value that \p user forwards. In this
362
358
// / case, this helper routine will eliminate \p value if it can rewrite user
Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ class SingleBlockOwnedForwardingInstFolder {
141
141
if (!hasOneNonDebugUse (next))
142
142
return false ;
143
143
144
+ assert (getSingleNonDebugUser (rest.back ()) == next);
144
145
rest.push_back (next);
145
146
return true ;
146
147
}
@@ -166,14 +167,13 @@ class SingleBlockOwnedForwardingInstFolder {
166
167
}
167
168
168
169
private:
169
- // / From backwards -> forwards, for each instruction in rest, delete all of
170
- // / its debug uses and then set its single remaining use to be SILUndef.
170
+ // / Processing from def->use by walking rest backwards , delete all of its
171
+ // / debug uses and then set its single remaining use to be SILUndef.
171
172
// /
172
173
// / This means that after this runs front's forwarding operand is now
173
174
// / SILUndef.
174
175
void cleanupRest () & {
175
- // We process backwards -> forwards. This cleans up everything but the front
176
- // value.
176
+ // We process from def->use. This cleans up everything but the front value.
177
177
while (!rest.empty ()) {
178
178
auto *inst = rest.pop_back_val ();
179
179
deleteAllDebugUses (inst, SC.getInstModCallbacks ());
You can’t perform that action at this time.
0 commit comments