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

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 7 10:45:19 PST 2025


================
@@ -16,8 +16,14 @@ declare void @use_i64(i64)
 declare void @use_ptr(ptr addrspace(1))
 
 define i64 @constant_fold_ptrtoint_gep_zero() {
-; ALL-LABEL: define {{[^@]+}}@constant_fold_ptrtoint_gep_zero() {
-; ALL-NEXT:    ret i64 0
+; LLPARSER-LABEL: define {{[^@]+}}@constant_fold_ptrtoint_gep_zero() {
+; LLPARSER-NEXT:    ret i64 ptrtoint (ptr addrspace(1) null to i64)
+;
+; INSTSIMPLIFY-LABEL: define {{[^@]+}}@constant_fold_ptrtoint_gep_zero() {
+; INSTSIMPLIFY-NEXT:    ret i64 ptrtoint (ptr addrspace(1) null to i64)
----------------
shiltian wrote:

Yes, there are several places where the handling needs to be updated.

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


More information about the llvm-commits mailing list