[llvm] [SPIRV] Emitting DebugSource, DebugCompileUnit (PR #97558)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 4 05:00:44 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);
----------------
bwlodarcz wrote:

Thanks for suggestion. Unfortunately usage of early stopping is less efficient in small to medium set linear search loop for simple types. It's introduces one additional branch which at least once will involve penalty for missing prediction and pipeline dump. In addition to that, the branch avoidance allows for loop unroll optimization and allow compiler vectorization optimization.

https://github.com/llvm/llvm-project/pull/97558


More information about the llvm-commits mailing list