[llvm] [InferAS] Infer the address space of inttoptr (PR #173244)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 30 07:00:35 PST 2026
================
@@ -45,8 +45,9 @@ define void @test_xor_smem(ptr addrspace(3) %sp) {
; CHECK-NEXT: [[GP:%.*]] = addrspacecast ptr addrspace(3) [[SP]] to ptr
; CHECK-NEXT: [[A:%.*]] = ptrtoint ptr [[GP]] to i64
; CHECK-NEXT: [[B:%.*]] = xor i64 4095, [[A]]
-; CHECK-NEXT: [[GP2:%.*]] = inttoptr i64 [[B]] to ptr addrspace(3)
-; CHECK-NEXT: store i16 0, ptr addrspace(3) [[GP2]], align 2
+; CHECK-NEXT: [[GP2:%.*]] = inttoptr i64 [[B]] to ptr
+; CHECK-NEXT: [[TMP1:%.*]] = addrspacecast ptr [[GP2]] to ptr addrspace(3)
+; CHECK-NEXT: store i16 0, ptr addrspace(3) [[TMP1]], align 2
----------------
arsenm wrote:
The two separate casts is probably better and more canonical. InstCombine prefers to keep ptrtoint results as the no-op pointer width, and separate the integer cast to the final result type
https://github.com/llvm/llvm-project/pull/173244
More information about the llvm-commits
mailing list