| Issue |
237498
|
| Summary |
[AArch64] llc segfaults on big-endian when a GC statepoint spills a vector to a stack slot
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
dongjianqiang2
|
llc segfaults on aarch64_be when a GC statepoint keeps a vector in its "gc-live" set. Same IR as test/CodeGen/AArch64/pr142314.ll with a big-endian datalayout/triple:
```llvm
target datalayout = "E-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "aarch64_be-linux-gnu"
define <2 x ptr addrspace(1)> @widget() nounwind gc "statepoint-example" {
bb:
%call31 = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i32 (ptr addrspace(1), ptr addrspace(1), double)) null, i32 3, i32 0, ptr addrspace(1) null, ptr addrspace(1) null, double 0.000000e+00, i32 0, i32 0) [ "gc-live"(ptr addrspace(1) null, <2 x ptr addrspace(1)> zeroinitializer, ptr addrspace(1) null) ]
%call4 = call coldcc <2 x ptr addrspace(1)> @llvm.experimental.gc.relocate.v2p1(token %call31, i32 0, i32 1)
%sv = shufflevector <2 x ptr addrspace(1)> zeroinitializer, <2 x ptr addrspace(1)> %call4, <2 x i32> <i32 0, i32 3>
ret <2 x ptr addrspace(1)> %sv
}
declare token @llvm.experimental.gc.statepoint.p0(i64 immarg, i32 immarg, ptr, i32 immarg, i32 immarg, ...)
declare <2 x ptr addrspace(1)> @llvm.experimental.gc.relocate.v2p1(token, i32 immarg, i32 immarg)
```
```
$ llc test.ll -o -
Stack dump:
0. Program arguments: llc test.ll -o -
1. Running pass 'Function Pass Manager' on module 'test.ll'.
2. Running pass 'Local Stack Slot Allocation' on function '@widget'
#4 ... AArch64InstrInfo::isPairableLdStInst
#5 ... isAArch64FrameOffsetLegal
#6 ... AArch64RegisterInfo::needsFrameBaseReg
Segmentation fault (core dumped)
```
https://godbolt.org/z/3MP1YsxcT
(also reproduces on aarch64-fixup-statepoint-regs-crash.ll. Little-endian is fine.)
Cause: on big-endian, vector stores are selected as the structured ST1One/LD1One pseudos, which cannot take an immediate offset. isAArch64FrameOffsetLegal() bails out early for structured spills, but its list covers only the LD1R and Two/Three/Four variants, not One, so the MI falls through to the addressing-mode decoding and reads a non-existent base operand. Only pre-allocated stack slots are affected: LocalStackSlotAllocation only queries needsFrameBaseReg for those, which is why regular vector spills never hit this.
Fix is to add the 16 One variants to that switch; verified locally, will send a PR.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs