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

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 11 00:51:01 PST 2025


tbaederr wrote:

> Yes, that's the interesting question. Currently we assume that if __builtin_constant_p(__begin <= __ptr && __ptr < __end) is false, __ptr can't be within the the range [__begin, __ptr).

Thinking about this some more, I'm not sure if this is even true. `__builtin_constant_p` will return `true` if that comparison can be folded, it doesn't matter if the result of the comparison is true or not: https://godbolt.org/z/fchbK977T

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


More information about the cfe-commits mailing list