[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 llvm-commits llvm-commits at lists.llvm.org
Mon Nov 17 10:42:08 PST 2025


================
@@ -22,7 +22,7 @@ define i8 @test_load8(ptr %a) sanitize_hwaddress {
 ; CHECK-LABEL: define i8 @test_load8
 ; CHECK-SAME: (ptr [[A:%.*]]) #[[ATTR0:[0-9]+]] {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)
+; CHECK-NEXT:    [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr zeroinitializer)
----------------
arichardson wrote:

Hmm looking at `HWAddressSanitizer::getShadowNonTls` this does actually need to be an integer converted to a pointer, so it needs to be zero even if null pointers are all ones. The commit message says it's there to avoid rematerializing constants, so maybe it could be omitted for the zero case but I am not too familiar with this code (@pcc).

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


More information about the llvm-commits mailing list