[llvm] [SPIRV] Emitting DebugSource, DebugCompileUnit (PR #97558)
Vyacheslav Levytskyy via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 4 02:16:50 PDT 2024
================
@@ -427,7 +426,22 @@ void SPIRVModuleAnalysis::processOtherInstrs(const Module &M) {
if (MAI.getSkipEmission(&MI))
continue;
const unsigned OpCode = MI.getOpcode();
- if (OpCode == SPIRV::OpName || OpCode == SPIRV::OpMemberName) {
+ if (OpCode == SPIRV::OpString) {
+ collectOtherInstr(MI, MAI, SPIRV::MB_DebugStrings, IS);
+ } else if (OpCode == SPIRV::OpExtInst) {
+ MachineOperand Ins = MI.getOperand(3);
+ namespace NS = SPIRV::NonSemanticExtInst;
+ static constexpr int64_t GlobalNonSemanticDITy[] = {
+ NS::DebugSource, NS::DebugCompilationUnit};
+ bool IsGlobalDI = false;
+ for (unsigned Idx = 0; Idx < std::size(GlobalNonSemanticDITy);
----------------
VyacheslavLevytskyy wrote:
Please omit the braces (see https://llvm.org/docs/CodingStandards.html#:~:text=//%20This%20should%20also%20omit%20braces.%20%20The%20%60for%60%20loop%20contains%20only%20a%20single), and also if you make the condition `Idx < std::size(GlobalNonSemanticDITy) && !IsGlobalDI` this would help to stop immediately without a need to traverse the list to the very end.
https://github.com/llvm/llvm-project/pull/97558
More information about the llvm-commits
mailing list