Internals: Add cloneTreePure to prepare for side effect check.

Use cloneTreePure when what is being cloned must be side-effect free.
Use cloneTree when safe to contain side effects (e.g. cloning module).
This commit is contained in:
Wilson Snyder
2023-09-16 22:50:54 -04:00
parent cd1fe64e6c
commit 761adf1cf0
25 changed files with 193 additions and 180 deletions
+2
View File
@@ -767,6 +767,8 @@ protected:
// Clone this if into its set of split blocks
AstSplitPlaceholder* const if_placeholderp = makePlaceholderp();
AstSplitPlaceholder* const else_placeholderp = makePlaceholderp();
// We check for condition isPure earlier, but may still clone a
// non-pure to separate from other pure statements.
AstIf* const clonep = new AstIf{nodep->fileline(), nodep->condp()->cloneTree(true),
if_placeholderp, else_placeholderp};
const AstIf* const origp = VN_CAST(nodep, If);