Skip to content

Commit 19c1617

Browse files
committed
PredictableMemOpts: handle mark_dependence source promotion
1 parent 2e9daa4 commit 19c1617

File tree

2 files changed

+232
-20
lines changed

2 files changed

+232
-20
lines changed

lib/SILOptimizer/Mandatory/PMOMemoryUseCollector.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,18 @@ bool ElementUseCollector::collectUses(SILValue Pointer) {
469469
Uses.emplace_back(User, PMOUseKind::DependenceBase);
470470
continue;
471471
}
472+
SILValue value = md->getValue();
473+
assert(value == UI->get() && "missing mark_dependence use");
474+
// A mark_dependence creates a new dependent value in the same memory
475+
// location. Analogous to a load + init.
476+
Uses.emplace_back(User, PMOUseKind::Load);
477+
Uses.emplace_back(User, PMOUseKind::Initialization);
478+
if (!collectUses(md))
479+
return false;
480+
481+
continue;
472482
}
483+
473484
// Otherwise, the use is something complicated, it escapes.
474485
Uses.emplace_back(User, PMOUseKind::Escape);
475486
}

0 commit comments

Comments
 (0)