dtcxzyw wrote:

> I'd still prefer to get this right for all address-spaces, so we don't need 
> to revisit later.

Sentinel pointer value support for non-0 address spaces is still work in 
progress: https://github.com/llvm/llvm-project/pull/83109 
I am ok to add a helper like `Address::isConstantNull` if needed.

> But really, I'm more concerned about the "happens to get folded" part: there 
> isn't a stable set of values that get constant-folded, at the LLVM IR level, 
> it's just whether IRBuilder happens to do today. 

I don't expect it to work on more complex patterns like `(int*)(x-x)`.

> The only way to get a stable answer is to query the AST 
> (Expr::isNullPointerConstant).

`Expr::isNullPointerConstant` is unavailable in clang CodeGen unless we store 
the result into `Address`.


https://github.com/llvm/llvm-project/pull/130734
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to