[PATCH] D67493: [RISCV] Move DebugLoc Copy into CompressInstEmitter

Sam Elliott via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 12:06:02 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rGa0f43b004358: [RISCV] Move DebugLoc Copy into CompressInstEmitter (authored by lenary).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67493/new/

https://reviews.llvm.org/D67493

Files:
  llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
  llvm/test/MC/RISCV/compress-debug-info.s
  llvm/utils/TableGen/RISCVCompressInstEmitter.cpp


Index: llvm/utils/TableGen/RISCVCompressInstEmitter.cpp
===================================================================
--- llvm/utils/TableGen/RISCVCompressInstEmitter.cpp
+++ llvm/utils/TableGen/RISCVCompressInstEmitter.cpp
@@ -728,6 +728,7 @@
       }
       ++OpNo;
     }
+    CodeStream.indent(6) << "OutInst.setLoc(MI.getLoc());\n";
     CaseStream << mergeCondAndCode(CondStream, CodeStream);
     PrevOp = CurOp;
   }
Index: llvm/test/MC/RISCV/compress-debug-info.s
===================================================================
--- /dev/null
+++ llvm/test/MC/RISCV/compress-debug-info.s
@@ -0,0 +1,20 @@
+# RUN: llvm-mc -triple riscv32 -mattr=+c %s -g -o - -riscv-no-aliases \
+# RUN:   | FileCheck %s -check-prefixes=COMPRESS,BOTH
+# RUN: llvm-mc -triple riscv32 %s -g -o - -riscv-no-aliases \
+# RUN:   | FileCheck %s -check-prefixes=UNCOMPRESS,BOTH
+
+
+# This file ensures that compressing an instruction preserves its debug info.
+
+
+# BOTH-LABEL: .text
+
+# BOTH: .file 1
+# BOTH-SAME: "compress-debug-info.s"
+
+# BOTH:            .loc 1 [[# @LINE + 3 ]] 0
+# UNCOMPRESS-NEXT: addi a0, a1, 0
+# COMPRESS-NEXT:   c.mv a0, a1
+addi a0, a1, 0
+
+# BOTH-LABEL: .debug_info
Index: llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
===================================================================
--- llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -1610,7 +1610,6 @@
 void RISCVAsmParser::emitToStreamer(MCStreamer &S, const MCInst &Inst) {
   MCInst CInst;
   bool Res = compressInst(CInst, Inst, getSTI(), S.getContext());
-  CInst.setLoc(Inst.getLoc());
   S.EmitInstruction((Res ? CInst : Inst), getSTI());
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67493.233845.patch
Type: text/x-patch
Size: 1703 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191213/a01260be/attachment.bin>


More information about the llvm-commits mailing list