From 4f5d67b3e414cf5f2c9f7440e97837b718bda4cc Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Sun, 13 Jul 2025 16:06:27 -0700 Subject: [AArch64] "Support" debug info for SVE types on Windows. (#147865) There isn't any way to encode a variable in an SVE register, and there isn't any way to encode a scalable offset, and as far as I know that's unlikely to change in the near future. So suppress any debug info which would require those encodings. This isn't ideal, but we need to ship something which doesn't crash. Alternatively, for Z registers, we could emit debug info assuming the vector length is 128 bits, but that seems like it would lead to unintuitive results. The change to AArch64FrameLowering is needed to avoid a crash. But we can't actually test that the returned offset is correct: LiveDebugValues performs the query, then discards the result. --- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp') diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index bc74daf..8abeb56 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -1318,8 +1318,10 @@ void CodeViewDebug::collectVariableInfoFromMFTable( TFI->getFrameIndexReference(*Asm->MF, VI.getStackSlot(), FrameReg); uint16_t CVReg = TRI->getCodeViewRegNum(FrameReg); - assert(!FrameOffset.getScalable() && - "Frame offsets with a scalable component are not supported"); + if (FrameOffset.getScalable()) { + // No encoding currently exists for scalable offsets; bail out. + continue; + } // Calculate the label ranges. LocalVarDef DefRange = @@ -1410,6 +1412,11 @@ void CodeViewDebug::calculateRanges( if (Location->FragmentInfo->OffsetInBits % 8) continue; + if (TRI->isIgnoredCVReg(Location->Register)) { + // No encoding currently exists for this register; bail out. + continue; + } + LocalVarDef DR; DR.CVRegister = TRI->getCodeViewRegNum(Location->Register); DR.InMemory = !Location->LoadChain.empty(); -- cgit v1.1