shader: hand IR uses over at once on replacement and skip use lists at program teardown

This commit is contained in:
Senaxx authored and nmzik committed 2026-10-27 07:04:38 +01:00
1 parent 1ec69f8e7d
commit a526a8b9c9
4 files changed
+63 -23

No files matched your search

@@ -118,15 +118,14 @@ ResourcePlan& ResourcePlan::operator=(ResourcePlan&& other) noexcept {
}
Program::~Program() {
// Planning expressions can refer to block values but outlive block storage in the base class.
// Planning expressions can refer to block values but outlive block storage in the base class,
// and values cross block boundaries: detach everything before any storage is destroyed.
for (auto& inst: value_storage) {
inst.Invalidate();
inst.DropArgs();
}
// Values may cross block boundaries. Detach all arguments before any block starts destroying
// its instruction storage so reverse-use links always point to live definitions.
for (auto* block: blocks) {
for (auto& inst: *block) {
inst.Invalidate();
inst.DropArgs();
}
}
}