[llvm] [SPIR-V] Emit DebugTypeBasic for NonSemantic DI (PR #106980)

Vyacheslav Levytskyy via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 04:54:53 PDT 2024


================
@@ -104,6 +109,24 @@ bool SPIRVEmitNonSemanticDI::emitGlobalDI(MachineFunction &MF) {
                 cast<ConstantAsMetadata>(Op->getOperand(2))->getValue())
                 ->getSExtValue();
     }
+
+    // This traversal is the only supported way to access
+    // instruction related DI metadata like DIBasicType
+    for (auto &F : *M) {
+      for (auto &BB : F) {
----------------
VyacheslavLevytskyy wrote:

Please see also available API in https://llvm.org/docs/RemoveDIsDebugInfo.html, https://github.com/llvm/llvm-project/blob/daf208598b06a0b8b3dc3c30b023334182bdf170/llvm/include/llvm/IR/DebugProgramInstruction.h#L547 and an example of usage in https://github.com/llvm/llvm-project/blob/daf208598b06a0b8b3dc3c30b023334182bdf170/llvm/lib/Bitcode/Reader/MetadataLoader.cpp#L623

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


More information about the llvm-commits mailing list