[clang] [clang][AST] Stop creating `ConstantExpr` nodes without a result (PR #229761)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 8 08:08:27 PDT 2026
tbaederr wrote:
> I do not know if this is a good change - There is a pre-existing bug that we recompute constant expressions more than we should [#62947 (comment)](https://github.com/llvm/llvm-project/issues/62947#issuecomment-4215827086) And sure, void expressions don't have a result but if we do not cache them they'd be recomputed anyway.
>
> I don't know how this will matter in the long run - it currently does not per your benchmarks - but if anything we should probably use ConstantExpr in more places, not fewer.
The intent is not to disable caching for void nodes, but to _not_ create ConstantExpr nodes if we have no result at all (so if the evaluation failed, or if we never evaluated anything). A void ConstantExpr with a `None` result still tells us that the evaluation succeeded.
https://github.com/llvm/llvm-project/pull/229761
More information about the cfe-commits
mailing list