Skip to content

Commit af8e7d2

Browse files
committed
SILGen: Remove some dead code
1 parent 143b4cf commit af8e7d2

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

lib/SILGen/SILGenProfiling.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ struct MapRegionCounters : public ASTWalker {
123123
CounterMap[WS->getBody()] = NextCounter++;
124124
} else if (auto *RWS = dyn_cast<RepeatWhileStmt>(S)) {
125125
CounterMap[RWS->getBody()] = NextCounter++;
126-
} else if (auto *FS = dyn_cast<ForStmt>(S)) {
127-
CounterMap[FS->getBody()] = NextCounter++;
128126
} else if (auto *FES = dyn_cast<ForEachStmt>(S)) {
129127
CounterMap[FES->getBody()] = NextCounter++;
130128
walkPatternForProfiling(FES->getIterator(), *this);
@@ -536,14 +534,6 @@ struct CoverageMapping : public ASTWalker {
536534
assignCounter(RWS->getCond(), CounterExpr::Ref(BodyCounter));
537535
RepeatWhileStack.push_back(RWS);
538536

539-
} else if (auto *FS = dyn_cast<ForStmt>(S)) {
540-
assignCounter(FS, CounterExpr::Zero());
541-
if (Expr *E = FS->getCond().getPtrOrNull())
542-
assignCounter(E, CounterExpr::Ref(getCurrentCounter()));
543-
if (Expr *E = FS->getIncrement().getPtrOrNull())
544-
assignCounter(E, CounterExpr::Zero());
545-
assignCounter(FS->getBody());
546-
547537
} else if (auto *FES = dyn_cast<ForEachStmt>(S)) {
548538
assignCounter(FES, CounterExpr::Zero());
549539
assignCounter(FES->getBody());
@@ -593,23 +583,14 @@ struct CoverageMapping : public ASTWalker {
593583
(void) RWS;
594584
RepeatWhileStack.pop_back();
595585

596-
} else if (auto *FS = dyn_cast<ForStmt>(S)) {
597-
// Both the condition and the increment are reached through the backedge.
598-
if (Expr *E = FS->getCond().getPtrOrNull())
599-
addToCounter(E, getExitCounter());
600-
if (Expr *E = FS->getIncrement().getPtrOrNull())
601-
addToCounter(E, getExitCounter());
602-
603586
} else if (auto *CS = dyn_cast<ContinueStmt>(S)) {
604587
// Continues create extra backedges, add them to the appropriate counters.
605588
if (!isa<RepeatWhileStmt>(CS->getTarget()))
606589
addToCounter(CS->getTarget(), getCurrentCounter());
607590
if (auto *WS = dyn_cast<WhileStmt>(CS->getTarget())) {
608591
if (auto *E = getConditionNode(WS->getCond()))
609592
addToCounter(E, getCurrentCounter());
610-
} else if (auto *FS = dyn_cast<ForStmt>(CS->getTarget()))
611-
if (Expr *E = FS->getCond().getPtrOrNull())
612-
addToCounter(E, getCurrentCounter());
593+
}
613594
terminateRegion(S);
614595

615596
} else if (auto *BS = dyn_cast<BreakStmt>(S)) {

0 commit comments

Comments
 (0)