mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2025-01-15 02:40:04 +00:00
AggressiveDCEPass: Set modified to true when appending to to_kill_ (#2825)
Also add an assertion that these `modified` is true if to_kill_ has a non-zero size to catch this sort of issue in the pass. Fixes: #2824
This commit is contained in:
parent
d67130caca
commit
65e362b7ae
@ -664,6 +664,9 @@ Pass::Status AggressiveDCEPass::ProcessImpl() {
|
|||||||
// been marked, it is safe to remove dead global values.
|
// been marked, it is safe to remove dead global values.
|
||||||
modified |= ProcessGlobalValues();
|
modified |= ProcessGlobalValues();
|
||||||
|
|
||||||
|
// Sanity check.
|
||||||
|
assert(to_kill_.size() == 0 || modified);
|
||||||
|
|
||||||
// Kill all dead instructions.
|
// Kill all dead instructions.
|
||||||
for (auto inst : to_kill_) {
|
for (auto inst : to_kill_) {
|
||||||
context()->KillInst(inst);
|
context()->KillInst(inst);
|
||||||
@ -846,6 +849,7 @@ bool AggressiveDCEPass::ProcessGlobalValues() {
|
|||||||
if (!IsDead(ptr_ty_inst)) continue;
|
if (!IsDead(ptr_ty_inst)) continue;
|
||||||
}
|
}
|
||||||
to_kill_.push_back(&val);
|
to_kill_.push_back(&val);
|
||||||
|
modified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user