Fix assert that doesn't check anything.

Move the assert that checks for the end iterator inside the loop which
actually moves over the elements.  This allows it to check that the
iteration stays within the range.
This commit is contained in:
Weverything 2020-01-23 16:03:31 -08:00
parent c467faf23c
commit fe5f233a93
1 changed files with 4 additions and 4 deletions

View File

@ -244,12 +244,12 @@ struct DivergencePropagator {
);
auto ItBeginRPO = FuncRPOT.begin();
auto ItEndRPO = FuncRPOT.end();
// skip until term (TODO RPOT won't let us start at @term directly)
for (; *ItBeginRPO != &RootBlock; ++ItBeginRPO) {}
auto ItEndRPO = FuncRPOT.end();
assert(ItBeginRPO != ItEndRPO);
for (; *ItBeginRPO != &RootBlock; ++ItBeginRPO) {
assert(ItBeginRPO != ItEndRPO && "Unable to find RootBlock");
}
// propagate definitions at the immediate successors of the node in RPO
auto ItBlockRPO = ItBeginRPO;