sharing IR for expressions across statements?

We’re synthesizing some clang AST expressions as part of a research project to add more checking to C. I have a question about Expr and its subclasses in the clang AST. Is it OK to share expression nodes across statements or is it assumed that expressions are not shared across statements? For example, if I have an Expr e and I want to build two assignment expressions tmp1 = e and tmp2 = e + 5, do I need to clone e so that there are not two pointers to e?

For context, we have a way of declaring bounds for pointer variables. From that, we can infer bounds for C expressions. We’ll then use the inferred bounds to inject runtime bounds checks at memory dereferences. It’s quite natural to share the expressions for bounds across statements in this situation.

Thanks,

David