[clang] [clang][bytecode] Implement __builtin_constant_p differently (PR #122099)

Nikolas Klauser via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 8 09:29:05 PST 2025


philnik777 wrote:

Does this mean we should avoid `__builtin_constant_p` during constant evaluation when possible and instead add custom builtins in the few places we actually need the correct answer during constant evaluation?

We currently use `__builtin_constant_p` in two different cases:
- We check which one is the currently active member of a union, and
- We check whether two pointers are in the same range

Is that possible to implement in the interpreter without going back to AST visitors?

https://github.com/llvm/llvm-project/pull/122099


More information about the cfe-commits mailing list