Fix invalid code motion over branches (#5811) (#5814)

This commit is contained in:
Geza Lore
2025-02-28 13:32:03 -05:00
committed by GitHub
parent a9762e0c5c
commit 14f618b0f6
3 changed files with 43 additions and 2 deletions
+2 -2
View File
@@ -245,8 +245,8 @@ class CodeMotionAnalysisVisitor final : public VNVisitorConst {
}
void analyzeNode(AstNode* nodep) {
// If an impure node under a statement, mark that statement as impure
if (m_propsp && !nodep->isPure()) m_propsp->m_isFence = true;
// If impure, or branch, mark statement as fence
if (m_propsp && (!nodep->isPure() || nodep->isBrancher())) m_propsp->m_isFence = true;
// Analyze children
iterateChildrenConst(nodep);
}