| Issue |
234056
|
| Summary |
[AArch64] llc asserts/segfaults on any ghccc function with a Windows triple (getZPRCalleeSavedStackSize)
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
waroad
|
`llc` crashes in Prologue/Epilogue Insertion on any `ghccc` function when targeting AArch64 Windows, even an empty one.
```llvm
define ghccc void @f() {
ret void
}
```
```
llc -mtriple=aarch64-pc-windows-msvc -verify-machineinstrs -o /dev/null reduced.ll
```
```
llc: llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h:413: unsigned int llvm::AArch64FunctionInfo::getZPRCalleeSavedStackSize() const: Assertion `HasSVECalleeSavedStackSize && "ZPRCalleeSavedStackSize has not been calculated"' failed.
Stack dump:
1. Running pass 'Function Pass Manager' on module 'reduced.ll'.
2. Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@f'
```
I expected it to compile: the IR is valid and LangRef lists `ghccc` as supported on AArch64 without an OS restriction. The same function compiles for `aarch64-linux-gnu`, and a non-`ghccc` function compiles for the Windows triple; `aarch64-pc-windows-gnu` crashes the same way. GHC's LLVM backend emits `ghccc` functions.
Reproduces at b9aed8f7cae8 (the assertion above). A release build without assertions segfaults there too (exit 139); in an earlier build of main the crash was in `MachineInstr::getMF` called from `AArch64EpilogueEmitter::finalizeEpilogue`.
Looks like `AArch64FrameLowering::determineCalleeSaves` returns early for `CallingConv::GHC`, so `setSVECalleeSavedStackSize` is never called, but on Windows the prologue/epilogue emitters still run and `hasSVECalleeSavesAboveFrameRecord` reads the size (AArch64FrameLowering.cpp). Possibly related: #147561 (closed), about the SVE stack size being used before it is determined. Open PR #230429 changes the Windows epilogue code (`finalizeEpilogue`) and may be related; I have not tested it.
Found with an LLM-based testing tool; I used Claude to reduce it and look for the cause.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs