diff --git a/src/llvmir2hll/ir/statement.cpp b/src/llvmir2hll/ir/statement.cpp index 6d0677a11..c63f54757 100644 --- a/src/llvmir2hll/ir/statement.cpp +++ b/src/llvmir2hll/ir/statement.cpp @@ -300,7 +300,8 @@ void Statement::removeStatement(ShPtr stmt) { // target's predecessors - target is not goto's successor. if (auto gotoStmt = cast(stmt)) { if (gotoStmt->getTarget()) { - gotoStmt->getTarget()->preds.erase(stmt); + gotoStmt->getTarget()->removeObserver(stmt); + gotoStmt->getTarget()->removePredecessor(stmt); preserveLabel(stmt, gotoStmt->getTarget()); } } @@ -503,7 +504,8 @@ void Statement::replaceStatement(ShPtr oldStmt, // target's predecessors - target is not goto's successor. if (auto gotoStmt = cast(oldStmt)) { if (gotoStmt->getTarget()) { - gotoStmt->getTarget()->preds.erase(oldStmt); + gotoStmt->getTarget()->removeObserver(oldStmt); + gotoStmt->getTarget()->removePredecessor(oldStmt); } }