[llvm] [SPIRV] Migrate NSDI emission from a machine pass to DebugHandlerBase (PR #191212)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 00:52:32 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.h llvm/lib/Target/SPIRV/SPIRV.h llvm/lib/Target/SPIRV/SPIRVAsmPrinter.cpp llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp b/llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp
index 1b52ac799..01c74e4fc 100644
--- a/llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp
@@ -196,8 +196,7 @@ MCRegister SPIRVNonSemanticDebugHandler::findOrEmitOpTypeInt32(
SPIRV::ModuleAnalysisInfo &MAI) {
for (const MachineInstr *MI : MAI.getMSInstrs(SPIRV::MB_TypeConstVars)) {
if (MI->getOpcode() == SPIRV::OpTypeInt &&
- MI->getOperand(1).getImm() == 32 &&
- MI->getOperand(2).getImm() == 0)
+ MI->getOperand(1).getImm() == 32 && MI->getOperand(2).getImm() == 0)
return MAI.getRegisterAlias(MI->getMF(), MI->getOperand(0).getReg());
}
MCRegister Reg = MAI.getNextIDRegister();
@@ -222,19 +221,17 @@ void SPIRVNonSemanticDebugHandler::emitDebugTypePointer(
// For SPIR-V targets, Clang sets DwarfAddressSpace to the LLVM IR address
// space, which addressSpaceToStorageClass expects.
- const auto &ST =
- static_cast<const SPIRVSubtarget &>(Asm->getSubtargetInfo());
+ const auto &ST = static_cast<const SPIRVSubtarget &>(Asm->getSubtargetInfo());
MCRegister StorageClassReg = emitOpConstantI32(
addressSpaceToStorageClass(PT->getDWARFAddressSpace().value(), ST),
I32TypeReg, MAI);
- if (const auto *BaseType =
- dyn_cast_or_null<DIBasicType>(PT->getBaseType())) {
+ if (const auto *BaseType = dyn_cast_or_null<DIBasicType>(PT->getBaseType())) {
auto BTIt = BasicTypeRegs.find(BaseType);
if (BTIt != BasicTypeRegs.end())
emitExtInst(SPIRV::NonSemanticExtInst::DebugTypePointer, VoidTypeReg,
- ExtInstSetReg,
- {BTIt->second, StorageClassReg, I32ZeroReg}, MAI);
+ ExtInstSetReg, {BTIt->second, StorageClassReg, I32ZeroReg},
+ MAI);
} else {
// Void pointer: use DebugInfoNone for the base type. Note that
// spirv-val currently rejects DebugInfoNone as the base type of
@@ -295,8 +292,8 @@ void SPIRVNonSemanticDebugHandler::emitNonSemanticGlobalDebugInfo(
// Pre-emit source language constants for all compile units before entering
// the DebugSource loop.
- SmallVector<MCRegister> SrcLangRegs = map_to_vector(
- CompileUnits, [&](const CompileUnitInfo &Info) {
+ SmallVector<MCRegister> SrcLangRegs =
+ map_to_vector(CompileUnits, [&](const CompileUnitInfo &Info) {
return emitOpConstantI32(Info.SpirvSourceLanguage, I32TypeReg, MAI);
});
@@ -371,6 +368,6 @@ void SPIRVNonSemanticDebugHandler::emitNonSemanticGlobalDebugInfo(
// Emit DebugTypePointer for each referenced pointer type.
for (const DIDerivedType *PT : PointerTypes)
- emitDebugTypePointer(PT, VoidTypeReg, I32TypeReg, ExtInstSetReg,
- I32ZeroReg, BasicTypeRegs, MAI);
+ emitDebugTypePointer(PT, VoidTypeReg, I32TypeReg, ExtInstSetReg, I32ZeroReg,
+ BasicTypeRegs, MAI);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/191212
More information about the llvm-commits
mailing list