Skip to content

Commit ec62258

Browse files
committed
NFC: explain the searchForExpectedValue
1 parent c54e788 commit ec62258

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/SILOptimizer/Analysis/ColdBlockInfo.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,13 @@ ColdBlockInfo::searchForExpectedValue(SILValue Cond,
144144
auto *predBB = Pair.first;
145145
auto predArg = Pair.second;
146146

147+
// We only want to consider values coming from a non-cold path of preds.
147148
if (isCold(predBB))
148149
continue;
149150

150151
std::optional<bool> predecessorValue;
151152

153+
// Look for an integer literal, otherwise, recurse.
152154
if (auto *IL = dyn_cast<IntegerLiteralInst>(predArg)) {
153155
predecessorValue = IL->getValue().getBoolValue();
154156
} else {
@@ -274,6 +276,8 @@ void ColdBlockInfo::analyze(SILFunction *fn) {
274276
LLVM_DEBUG(llvm::dbgs() << "--> Before Stage 1\n");
275277
LLVM_DEBUG(dump());
276278

279+
// The set of blocks for which we can skip searching for an expected
280+
// conditional value, as we've already determined which successor is cold.
277281
BasicBlockSet foundExpectedCond(fn);
278282

279283
// Stage 1: Seed the graph with warm/cold blocks.

0 commit comments

Comments
 (0)