[llvm] AMDGPU gfx12: Add _dvgpr$ symbols for dynamic VGPRs (PR #148251)
Tim Renouf via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 6 02:33:54 PDT 2025
https://github.com/trenouf updated https://github.com/llvm/llvm-project/pull/148251
>From 8d0fb2e3dcadf754c9d3a3a69716da7a48660783 Mon Sep 17 00:00:00 2001
From: Tim Renouf <tim.renouf at amd.com>
Date: Tue, 7 Jan 2025 20:15:29 +0000
Subject: [PATCH 1/6] AMDGPU gfx12: Add _dvgpr$ symbols for dynamic VGPRs
For each function with the AMDGPU_CS_Chain calling convention, with
dynamic VGPRs enabled, add a _dvgpr$ symbol, with the value of the
function symbol, plus an offset encoding one less than the number of
VGPR blocks used by the function (16 VGPRs per block, no more than 128)
in bits 5..3 of the symbol value. This is used by a front-end to have
functions that are chained rather than called, and a dispatcher that
dynamically resizes the VGPR count before dispatching to a function.
---
llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | 26 +++++++++++++++++++++
llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll | 12 ++++++++++
2 files changed, 38 insertions(+)
create mode 100644 llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
index 749b9efc81378..00ed5f57967ce 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -194,6 +194,32 @@ void AMDGPUAsmPrinter::emitFunctionBodyStart() {
return;
}
+ if (STM.isDynamicVGPREnabled() &&
+ MF->getFunction().getCallingConv() == CallingConv::AMDGPU_CS_Chain) {
+ // Add a _dvgpr$ symbol, with the value of the function symbol, plus an
+ // offset encoding one less than the number of VGPR blocks used by the
+ // function (16 VGPRs per block, no more than 128) in bits 5..3 of the
+ // symbol value. This is used by a front-end to have functions that are
+ // chained rather than called, and a dispatcher that dynamically resizes
+ // the VGPR count before dispatching to a function.
+ ResourceUsage = &getAnalysis<AMDGPUResourceUsageAnalysis>();
+ const AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo &Info =
+ ResourceUsage->getResourceInfo();
+ MCContext &Ctx = MF->getContext();
+ unsigned EncodedNumVGPRs = (Info.NumVGPR - 1) >> 1 & 0x38;
+ MCSymbol *CurPCSym = Ctx.createTempSymbol();
+ OutStreamer->emitLabel(CurPCSym);
+ const MCExpr *DVgprFuncVal = MCBinaryExpr::createAdd(
+ MCSymbolRefExpr::create(CurPCSym, MCSymbolRefExpr::VK_None, Ctx),
+ MCConstantExpr::create(EncodedNumVGPRs, Ctx), Ctx);
+ MCSymbol *DVgprFuncSym =
+ Ctx.getOrCreateSymbol(Twine("_dvgpr$") + MF->getFunction().getName());
+ OutStreamer->emitAssignment(DVgprFuncSym, DVgprFuncVal);
+ cast<MCSymbolELF>(DVgprFuncSym)
+ ->setBinding(
+ cast<MCSymbolELF>(getSymbol(&MF->getFunction()))->getBinding());
+ }
+
if (!MFI.isEntryFunction())
return;
diff --git a/llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll b/llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll
new file mode 100644
index 0000000000000..992963d304ead
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll
@@ -0,0 +1,12 @@
+; Test generation of _dvgpr$ symbol for an amdgpu_cs_chain function with +dynamic-vgpr.
+
+; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1200 -asm-verbose=0 < %s | FileCheck -check-prefixes=DVGPR %s
+
+; DVGPR-LABEL: func:
+; DVGPR: .Ltmp0:
+; DVGPR: .set _dvgpr$func, .Ltmp0+{{[0-9]+}}
+
+define amdgpu_cs_chain void @func() #0 {
+ ret void
+}
+attributes #0 = { "target-features"="+dynamic-vgpr" }
>From ca7d1cac94c49c1636eb89d21a28b1f0a4504cc0 Mon Sep 17 00:00:00 2001
From: Tim Renouf <tim.renouf at amd.com>
Date: Sat, 12 Jul 2025 11:01:37 +0100
Subject: [PATCH 2/6] Fix rebase mix-up
---
llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
index 00ed5f57967ce..4f87ced407398 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -202,15 +202,12 @@ void AMDGPUAsmPrinter::emitFunctionBodyStart() {
// symbol value. This is used by a front-end to have functions that are
// chained rather than called, and a dispatcher that dynamically resizes
// the VGPR count before dispatching to a function.
- ResourceUsage = &getAnalysis<AMDGPUResourceUsageAnalysis>();
- const AMDGPUResourceUsageAnalysis::SIFunctionResourceInfo &Info =
- ResourceUsage->getResourceInfo();
MCContext &Ctx = MF->getContext();
- unsigned EncodedNumVGPRs = (Info.NumVGPR - 1) >> 1 & 0x38;
+ unsigned EncodedNumVGPRs = (ResourceUsage->NumVGPR - 1) >> 1 & 0x38;
MCSymbol *CurPCSym = Ctx.createTempSymbol();
OutStreamer->emitLabel(CurPCSym);
const MCExpr *DVgprFuncVal = MCBinaryExpr::createAdd(
- MCSymbolRefExpr::create(CurPCSym, MCSymbolRefExpr::VK_None, Ctx),
+ MCSymbolRefExpr::create(CurPCSym, Ctx),
MCConstantExpr::create(EncodedNumVGPRs, Ctx), Ctx);
MCSymbol *DVgprFuncSym =
Ctx.getOrCreateSymbol(Twine("_dvgpr$") + MF->getFunction().getName());
>From f55bfa5fa42e7249ac674e9e4c94881ff36eb853 Mon Sep 17 00:00:00 2001
From: Tim Renouf <tim.renouf at amd.com>
Date: Tue, 15 Jul 2025 16:40:38 +0100
Subject: [PATCH 3/6] Various fixes
* Use new func attr;
* allow 16 or 32 block size;
* put code in its own func;
* enhance test, including anonymous func;
* fix name, visibility and linkage
---
llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | 72 ++++++++++++++-------
llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.h | 3 +
llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll | 62 ++++++++++++++++--
3 files changed, 108 insertions(+), 29 deletions(-)
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
index 4f87ced407398..2193c635579fb 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -41,6 +41,7 @@
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCStreamer.h"
+#include "llvm/MC/MCValue.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/AMDHSAKernelDescriptor.h"
#include "llvm/Support/Compiler.h"
@@ -194,29 +195,6 @@ void AMDGPUAsmPrinter::emitFunctionBodyStart() {
return;
}
- if (STM.isDynamicVGPREnabled() &&
- MF->getFunction().getCallingConv() == CallingConv::AMDGPU_CS_Chain) {
- // Add a _dvgpr$ symbol, with the value of the function symbol, plus an
- // offset encoding one less than the number of VGPR blocks used by the
- // function (16 VGPRs per block, no more than 128) in bits 5..3 of the
- // symbol value. This is used by a front-end to have functions that are
- // chained rather than called, and a dispatcher that dynamically resizes
- // the VGPR count before dispatching to a function.
- MCContext &Ctx = MF->getContext();
- unsigned EncodedNumVGPRs = (ResourceUsage->NumVGPR - 1) >> 1 & 0x38;
- MCSymbol *CurPCSym = Ctx.createTempSymbol();
- OutStreamer->emitLabel(CurPCSym);
- const MCExpr *DVgprFuncVal = MCBinaryExpr::createAdd(
- MCSymbolRefExpr::create(CurPCSym, Ctx),
- MCConstantExpr::create(EncodedNumVGPRs, Ctx), Ctx);
- MCSymbol *DVgprFuncSym =
- Ctx.getOrCreateSymbol(Twine("_dvgpr$") + MF->getFunction().getName());
- OutStreamer->emitAssignment(DVgprFuncSym, DVgprFuncVal);
- cast<MCSymbolELF>(DVgprFuncSym)
- ->setBinding(
- cast<MCSymbolELF>(getSymbol(&MF->getFunction()))->getBinding());
- }
-
if (!MFI.isEntryFunction())
return;
@@ -748,6 +726,9 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
OutContext, IsLocal));
}
+ // Emit _dvgpr$ symbol when appropriate.
+ emitDVgprSymbol(MF);
+
if (isVerbose()) {
MCSectionELF *CommentSection =
Context.getELFSection(".AMDGPU.csdata", ELF::SHT_PROGBITS, 0);
@@ -890,6 +871,51 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
return false;
}
+// When appropriate, add a _dvgpr$ symbol, with the value of the function
+// symbol, plus an offset encoding one less than the number of VGPR blocks used
+// by the function in bits 5..3 of the symbol value. A "VGPR block" can be
+// either 16 VGPRs (for a max of 128), or 32 VGPRs (for a max of 256). This is
+// used by a front-end to have functions that are chained rather than called,
+// and a dispatcher that dynamically resizes the VGPR count before dispatching
+// to a function.
+void AMDGPUAsmPrinter::emitDVgprSymbol(MachineFunction &MF) {
+ const SIMachineFunctionInfo &MFI = *MF.getInfo<SIMachineFunctionInfo>();
+ if (MFI.isDynamicVGPREnabled() &&
+ MF.getFunction().getCallingConv() == CallingConv::AMDGPU_CS_Chain) {
+ MCContext &Ctx = MF.getContext();
+ unsigned BlockSize = MFI.getDynamicVGPRBlockSize();
+ MCValue NumVGPRs;
+ if (!CurrentProgramInfo.NumVGPRsForWavesPerEU->evaluateAsRelocatable(
+ NumVGPRs, nullptr) ||
+ !NumVGPRs.isAbsolute()) {
+ OutContext.reportError({}, "Unable to resolve _dvgpr$ symbol for '" +
+ Twine(MF.getName()) + "'");
+ return;
+ }
+ // Calculate number of VGPR blocks.
+ // Treat 0 VGPRs as 1 VGPR to avoid underflowing.
+ unsigned NumBlocks =
+ (std::max(unsigned(NumVGPRs.getConstant()), 1U) + BlockSize - 1) /
+ BlockSize;
+ if (NumBlocks > 8) {
+ OutContext.reportError({},
+ "Too many DVGPR blocks for _dvgpr$ symbol for '" +
+ Twine(MF.getName()) + "'");
+ return;
+ }
+ unsigned EncodedNumBlocks = (NumBlocks - 1) << 3;
+ // Add to function symbol to create _dvgpr$ symbol.
+ const MCExpr *DVgprFuncVal = MCBinaryExpr::createAdd(
+ MCSymbolRefExpr::create(CurrentFnSym, Ctx),
+ MCConstantExpr::create(EncodedNumBlocks, Ctx), Ctx);
+ MCSymbol *DVgprFuncSym =
+ Ctx.getOrCreateSymbol(Twine("_dvgpr$") + CurrentFnSym->getName());
+ OutStreamer->emitAssignment(DVgprFuncSym, DVgprFuncVal);
+ emitVisibility(DVgprFuncSym, MF.getFunction().getVisibility());
+ emitLinkage(&MF.getFunction(), DVgprFuncSym);
+ }
+}
+
// TODO: Fold this into emitFunctionBodyStart.
void AMDGPUAsmPrinter::initializeTargetID(const Module &M) {
// In the beginning all features are either 'Any' or 'NotSupported',
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.h b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.h
index 63589d2b90062..9e854fa554672 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.h
@@ -54,6 +54,9 @@ class AMDGPUAsmPrinter final : public AsmPrinter {
MCCodeEmitter *DumpCodeInstEmitter = nullptr;
+ // When appropriate, add a _dvgpr$ symbol.
+ void emitDVgprSymbol(MachineFunction &MF);
+
void getSIProgramInfo(SIProgramInfo &Out, const MachineFunction &MF);
void getAmdKernelCode(AMDGPU::AMDGPUMCKernelCodeT &Out,
const SIProgramInfo &KernelInfo,
diff --git a/llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll b/llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll
index 992963d304ead..5825a93ddfc41 100644
--- a/llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll
+++ b/llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll
@@ -1,12 +1,62 @@
; Test generation of _dvgpr$ symbol for an amdgpu_cs_chain function with +dynamic-vgpr.
-; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1200 -asm-verbose=0 < %s | FileCheck -check-prefixes=DVGPR %s
+; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1200 < %s | FileCheck -check-prefixes=DVGPR %s
-; DVGPR-LABEL: func:
-; DVGPR: .Ltmp0:
-; DVGPR: .set _dvgpr$func, .Ltmp0+{{[0-9]+}}
+; Function with 0 VGPRs, which counts as 1 block.
+;
+; DVGPR-LABEL: func0:
+; DVGPR: .set _dvgpr$func0, func0+0
+;
+define amdgpu_cs_chain void @func0() #0 {
+ ret void
+}
+
+; Function with 21 VGPRs, which is 2 blocks.
+;
+; DVGPR-LABEL: func21:
+; DVGPR: .set _dvgpr$func21, func21+8
+;
+define amdgpu_cs_chain void @func21(<21 x float> %arg) #0 {
+ ret void
+}
+
+; Anonymous function with 87 VGPRs, which is 6 blocks.
+;
+; DVGPR: [[FUNC87:__unnamed[^:]*]]:
+; DVGPR: .set _dvgpr$[[FUNC87]], [[FUNC87]]+40
+;
+define amdgpu_cs_chain void @0(<87 x float> %arg) #0 {
+ ret void
+}
-define amdgpu_cs_chain void @func() #0 {
+; Function with 128 VGPRs, which is 8 blocks.
+;
+; DVGPR-LABEL: func128:
+; DVGPR: .set _dvgpr$func128, func128+56
+;
+define amdgpu_cs_chain void @func128(<128 x float> %arg) #0 {
+ %vec87 = shufflevector <128 x float> %arg, <128 x float> %arg, <87 x i32> splat(i32 0)
+ tail call void @0(<87 x float> %vec87)
ret void
}
-attributes #0 = { "target-features"="+dynamic-vgpr" }
+
+; Function with 79 VGPRs, which is 3 blocks with a block size of 32.
+;
+; DVGPR-LABEL: func79:
+; DVGPR: .set _dvgpr$func79, func79+16
+;
+define amdgpu_cs_chain void @func79(<79 x float> %arg) #1 {
+ ret void
+}
+
+; Function with 225 VGPRs, which is 8 blocks with a block size of 32.
+;
+; DVGPR-LABEL: func225:
+; DVGPR: .set _dvgpr$func225, func225+56
+;
+define amdgpu_cs_chain void @func225(<225 x float> %arg) #1 {
+ ret void
+}
+
+attributes #0 = { "amdgpu-dynamic-vgpr-block-size"="16" }
+attributes #1 = { "amdgpu-dynamic-vgpr-block-size"="32" }
>From 1d1b80a1a25b410898fd63b7546329d92c4bf9bc Mon Sep 17 00:00:00 2001
From: Tim Renouf <tim.renouf at amd.com>
Date: Tue, 15 Jul 2025 21:31:40 +0100
Subject: [PATCH 4/6] Document _dvgpr$ symbol
---
llvm/docs/AMDGPUUsage.rst | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst
index c5b9bd9de66e1..b129101a9b911 100644
--- a/llvm/docs/AMDGPUUsage.rst
+++ b/llvm/docs/AMDGPUUsage.rst
@@ -1768,6 +1768,10 @@ The AMDGPU backend supports the following LLVM IR attributes.
using dedicated instructions, but may not send the DEALLOC_VGPRS
message. If a shader has this attribute, then all its callees must
match its value.
+ An AMD_CS_Chain CC function with this enabled has an extra symbol
+ prefixed with "_dvgpr$" with the value of the function symbol,
+ offset by one less than the number of dynamic VGPR blocks required
+ by the function encoded in bits 5..3.
================================================ ==========================================================
>From 3adb1659433acfdabcb5dbb794477a83219adea1 Mon Sep 17 00:00:00 2001
From: Tim Renouf <tim.renouf at amd.com>
Date: Tue, 22 Jul 2025 07:48:05 +0100
Subject: [PATCH 5/6] Review comments
---
llvm/docs/AMDGPUUsage.rst | 2 +-
llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | 8 ++++----
llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll | 2 +-
.../dvgpr_sym_fail_too_many_block_size_16.ll | 19 +++++++++++++++++++
4 files changed, 25 insertions(+), 6 deletions(-)
create mode 100644 llvm/test/CodeGen/AMDGPU/dvgpr_sym_fail_too_many_block_size_16.ll
diff --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst
index b129101a9b911..878bfd640b750 100644
--- a/llvm/docs/AMDGPUUsage.rst
+++ b/llvm/docs/AMDGPUUsage.rst
@@ -1768,7 +1768,7 @@ The AMDGPU backend supports the following LLVM IR attributes.
using dedicated instructions, but may not send the DEALLOC_VGPRS
message. If a shader has this attribute, then all its callees must
match its value.
- An AMD_CS_Chain CC function with this enabled has an extra symbol
+ An amd_cs_chain CC function with this enabled has an extra symbol
prefixed with "_dvgpr$" with the value of the function symbol,
offset by one less than the number of dynamic VGPR blocks required
by the function encoded in bits 5..3.
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
index 2193c635579fb..e5fbed3d2aba8 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -888,8 +888,8 @@ void AMDGPUAsmPrinter::emitDVgprSymbol(MachineFunction &MF) {
if (!CurrentProgramInfo.NumVGPRsForWavesPerEU->evaluateAsRelocatable(
NumVGPRs, nullptr) ||
!NumVGPRs.isAbsolute()) {
- OutContext.reportError({}, "Unable to resolve _dvgpr$ symbol for '" +
- Twine(MF.getName()) + "'");
+ OutContext.reportError({}, "unable to resolve _dvgpr$ symbol for '" +
+ Twine(CurrentFnSym->getName()) + "'");
return;
}
// Calculate number of VGPR blocks.
@@ -899,8 +899,8 @@ void AMDGPUAsmPrinter::emitDVgprSymbol(MachineFunction &MF) {
BlockSize;
if (NumBlocks > 8) {
OutContext.reportError({},
- "Too many DVGPR blocks for _dvgpr$ symbol for '" +
- Twine(MF.getName()) + "'");
+ "too many DVGPR blocks for _dvgpr$ symbol for '" +
+ Twine(CurrentFnSym->getName()) + "'");
return;
}
unsigned EncodedNumBlocks = (NumBlocks - 1) << 3;
diff --git a/llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll b/llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll
index 5825a93ddfc41..487d864c29594 100644
--- a/llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll
+++ b/llvm/test/CodeGen/AMDGPU/dvgpr_sym.ll
@@ -1,4 +1,4 @@
-; Test generation of _dvgpr$ symbol for an amdgpu_cs_chain function with +dynamic-vgpr.
+; Test generation of _dvgpr$ symbol for an amdgpu_cs_chain function with dynamic vgprs.
; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1200 < %s | FileCheck -check-prefixes=DVGPR %s
diff --git a/llvm/test/CodeGen/AMDGPU/dvgpr_sym_fail_too_many_block_size_16.ll b/llvm/test/CodeGen/AMDGPU/dvgpr_sym_fail_too_many_block_size_16.ll
new file mode 100644
index 0000000000000..4ddb9e9ed0404
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/dvgpr_sym_fail_too_many_block_size_16.ll
@@ -0,0 +1,19 @@
+; Test failure to generate of _dvgpr$ symbol for an amdgpu_cs_chain function with dynamic vgprs.
+
+; RUN: not llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1200 < %s 2>&1 | FileCheck -check-prefixes=ERR %s
+
+define amdgpu_cs_chain void @0(<87 x float> %arg) #0 {
+ ret void
+}
+
+; Function with 129 VGPRs, which is too many with a block size of 16.
+;
+; ERR: too many DVGPR blocks for _dvgpr$ symbol for 'func129'
+;
+define amdgpu_cs_chain void @func129(<129 x float> %arg) #0 {
+ %vec87 = shufflevector <129 x float> %arg, <129 x float> %arg, <87 x i32> splat(i32 0)
+ tail call void @0(<87 x float> %vec87)
+ ret void
+}
+
+attributes #0 = { "amdgpu-dynamic-vgpr-block-size"="16" }
>From 6b20af2d1eb33a31e6b36ff87b6bde2e04fcc1a3 Mon Sep 17 00:00:00 2001
From: Tim Renouf <tim.renouf at amd.com>
Date: Wed, 6 Aug 2025 09:06:42 +0100
Subject: [PATCH 6/6] Change 'unable to resolve' error to unreachable as it
cannot happen
---
llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
index e5fbed3d2aba8..7215d73f0fd62 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -888,9 +888,7 @@ void AMDGPUAsmPrinter::emitDVgprSymbol(MachineFunction &MF) {
if (!CurrentProgramInfo.NumVGPRsForWavesPerEU->evaluateAsRelocatable(
NumVGPRs, nullptr) ||
!NumVGPRs.isAbsolute()) {
- OutContext.reportError({}, "unable to resolve _dvgpr$ symbol for '" +
- Twine(CurrentFnSym->getName()) + "'");
- return;
+ llvm_unreachable("unable to resolve NumVGPRs for _dvgpr$ symbol");
}
// Calculate number of VGPR blocks.
// Treat 0 VGPRs as 1 VGPR to avoid underflowing.
More information about the llvm-commits
mailing list