[llvm] [DataLayout] Add isNullPointerAllZeroes (PR #165314)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 28 01:42:25 PDT 2025


nikic wrote:

> I mean, assuming that the value of null is 0 would be wrong, no matter how it's currently implemented, right? See https://llvm.org/docs/AMDGPUUsage.html#address-spaces, for example

It is correct at the LLVM IR level.

The "NULL value" in this table presumably refers to `NULL` in C, which is handled by returning something like `ptr addrspace(3) addrspacecast (ptr null to ptr addrspace(3)). See https://github.com/llvm/llvm-project/blob/2f869c427b6c800f37147458ac03d1fa6f9ad9d3/clang/lib/CodeGen/Targets/AMDGPU.cpp#L455-L471

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


More information about the llvm-commits mailing list