The two checks added in eb86de63d901941fba0a54eb41551456447cd789, one in the Verifier and the other in SelectionDAGBuilder.cpp don't quite agree. The Verifier's respects the DataLayout, but the one in SelectionDAG only inspects the in-register type of a pointer, which on arm64_32 differs from its in-memory size.

```
$ cat reduced.ll 
target datalayout = "e-m:o-p:32:32-i64:64-i128:128-n32:64-S128"
target triple = "arm64_32-apple-watchos11.0.0"

define void @rdar125263567() {
entry:
  %aligned_result.i101.i = call ptr @llvm.ptrmask.p0.i32(ptr null, i32 0)
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare ptr @llvm.ptrmask.p0.i32(ptr, i32) #0

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
```

```
$ ./bin/llc reduced.ll
Assertion failed: (PtrVT == Mask.getValueType() && "Pointers with different index type are not supported by SDAG"), function visitIntrinsicCall, file SelectionDAGBuilder.cpp, line 7847.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: ./bin/llc reduced.ll
1.      Running pass 'Function Pass Manager' on module 'reduced.ll'.
2.      Running pass 'AArch64 Instruction Selection' on function '@rdar125263567'
 #0 0x0000000105adb594 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/jonathan_roelofs/llvm-upstream/build/bin/llc+0x103667594)
 #1 0x0000000105adbbb8 PrintStackTraceSignalHandler(void*) (/Users/jonathan_roelofs/llvm-upstream/build/bin/llc+0x103667bb8)
 #2 0x0000000105ad97d4 llvm::sys::RunSignalHandlers() (/Users/jonathan_roelofs/llvm-upstream/build/bin/llc+0x1036657d4)
 #3 0x0000000105adccd4 SignalHandler(int) (/Users/jonathan_roelofs/llvm-upstream/build/bin/llc+0x103668cd4)
 #4 0x0000000192e6eb44 (/usr/lib/system/libsystem_platform.dylib+0x180486b44)
 #5 0x0000000192e37bcc (/usr/lib/system/libsystem_pthread.dylib+0x18044fbcc)
 #6 0x0000000192d44900 (/usr/lib/system/libsystem_c.dylib+0x18035c900)
 #7 0x0000000192d43c24 (/usr/lib/system/libsystem_c.dylib+0x18035bc24)
 #8 0x0000000105769048 llvm::SelectionDAGBuilder::visitIntrinsicCall(llvm::CallInst const&, unsigned int) (/Users/jonathan_roelofs/llvm-upstream/build/bin/llc+0x1032f5048)
 #9 0x000000010574312c llvm::SelectionDAGBuilder::visitCall(llvm::CallInst const&) (/Users/jonathan_roelofs/llvm-upstream/build/bin/llc+0x1032cf12c)
<snip>
```
llvm.ptrmask broken on arm64_32: Pointers with different index type are not supported by SDAG
This is a GitHub Issue
repo:llvm-project
owner:llvm
Title : llvm.ptrmask broken on arm64_32: Pointers with different index type are not supported by SDAG
Issue date:

--- start body ---
The two checks added in eb86de63d901941fba0a54eb41551456447cd789, one in the Verifier and the other in SelectionDAGBuilder.cpp don't quite agree. The Verifier's respects the DataLayout, but the one in SelectionDAG only inspects the in-register type of a pointer, which on arm64_32 differs from its in-memory size.

```
$ cat reduced.ll 
target datalayout = "e-m:o-p:32:32-i64:64-i128:128-n32:64-S128"
target triple = "arm64_32-apple-watchos11.0.0"

define void @rdar125263567() {
entry:
  %aligned_result.i101.i = call ptr @llvm.ptrmask.p0.i32(ptr null, i32 0)
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare ptr @llvm.ptrmask.p0.i32(ptr, i32) #0

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
```

```
$ ./bin/llc reduced.ll
Assertion failed: (PtrVT == Mask.getValueType() && "Pointers with different index type are not supported by SDAG"), function visitIntrinsicCall, file SelectionDAGBuilder.cpp, line 7847.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: ./bin/llc reduced.ll
1.      Running pass 'Function Pass Manager' on module 'reduced.ll'.
2.      Running pass 'AArch64 Instruction Selection' on function '@rdar125263567'
 #0 0x0000000105adb594 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/jonathan_roelofs/llvm-upstream/build/bin/llc+0x103667594)
 #1 0x0000000105adbbb8 PrintStackTraceSignalHandler(void*) (/Users/jonathan_roelofs/llvm-upstream/build/bin/llc+0x103667bb8)
 #2 0x0000000105ad97d4 llvm::sys::RunSignalHandlers() (/Users/jonathan_roelofs/llvm-upstream/build/bin/llc+0x1036657d4)
 #3 0x0000000105adccd4 SignalHandler(int) (/Users/jonathan_roelofs/llvm-upstream/build/bin/llc+0x103668cd4)
 #4 0x0000000192e6eb44 (/usr/lib/system/libsystem_platform.dylib+0x180486b44)
 #5 0x0000000192e37bcc (/usr/lib/system/libsystem_pthread.dylib+0x18044fbcc)
 #6 0x0000000192d44900 (/usr/lib/system/libsystem_c.dylib+0x18035c900)
 #7 0x0000000192d43c24 (/usr/lib/system/libsystem_c.dylib+0x18035bc24)
 #8 0x0000000105769048 llvm::SelectionDAGBuilder::visitIntrinsicCall(llvm::CallInst const&, unsigned int) (/Users/jonathan_roelofs/llvm-upstream/build/bin/llc+0x1032f5048)
 #9 0x000000010574312c llvm::SelectionDAGBuilder::visitCall(llvm::CallInst const&) (/Users/jonathan_roelofs/llvm-upstream/build/bin/llc+0x1032cf12c)
<snip>
```
--- end body ---
