[llvm] [SPIRV] Emitting DebugSource, DebugCompileUnit (PR #97558)
Vyacheslav Levytskyy via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 4 02:14:25 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);
+ ++Idx) {
+ IsGlobalDI |= Ins.getImm() == GlobalNonSemanticDITy[Idx];
+ }
+ if (IsGlobalDI) {
----------------
VyacheslavLevytskyy wrote:
Please omit the braces when the body is clearly associated with the `if` (see https://llvm.org/docs/CodingStandards.html#:~:text=//%20Omit%20the%20braces%20since%20the%20body%20is%20simple%20and%20clearly%20associated%20with%20the)
https://github.com/llvm/llvm-project/pull/97558
More information about the llvm-commits
mailing list