Optimize dead code after gotos

This commit is contained in:
Wilson Snyder 2020-05-09 15:00:36 -04:00
parent a7e17a8855
commit c00cc18d37

View File

@ -2180,6 +2180,10 @@ private:
return; return;
} }
if (m_doExpensive) { if (m_doExpensive) {
// Any non-label statements (at this statement level) can never execute
while (nodep->nextp() && !VN_IS(nodep->nextp(), JumpLabel)) {
nodep->nextp()->unlinkFrBack()->deleteTree();
}
// If last statement in a jump label we have JumpLabel(...., JumpGo) // If last statement in a jump label we have JumpLabel(...., JumpGo)
// Often caused by "return" in a Verilog function. The Go is pointless, remove. // Often caused by "return" in a Verilog function. The Go is pointless, remove.
if (!nodep->nextp()) { if (!nodep->nextp()) {