[clang] [lld] [llvm] [WIP][IR][Constants] Change the semantic of `ConstantPointerNull` to represent an actual `nullptr` instead of a zero-value pointer (PR #166667)

Alexander Richardson via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 30 21:16:06 PST 2026


================
@@ -20,7 +20,7 @@
 
 @g = common global i32 0, align 4
 @h = common global i32 0, align 4
- at f = common global ptr null, align 4
+ at f = common global ptr zeroinitializer, align 4
----------------
arichardson wrote:

I agree that `null` should not be zero on all targets. I was just wondering if we can pass a DataLayout to more functions to avoid having to change all these tests? Since you said we can't always pass DataLayout, maybe  `ConstantPointerNull::isZeroValue()` could have an optional `DataLayout *` parameter that can be passed in most cases? I would imagine the DataLayout should be available in many cases and if not it might be better to try and plumb that through rather than force updating all tests?

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


More information about the cfe-commits mailing list