[PATCH] D148304: [LoongArch][NFC] Use empty debug location for register spill/reload

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 22:53:47 PDT 2023


benshi001 created this revision.
benshi001 added reviewers: SixWeining, XiaodongLoong, xen0n, wangleiat.
Herald added subscribers: pengfei, hiraditya, kristof.beyls.
Herald added a project: All.
benshi001 requested review of this revision.
Herald added subscribers: llvm-commits, jacquesguan.
Herald added a project: LLVM.

Spill/reload instructions are automatically generated by the compiler
and have no relation to the original source code. So it would be better
to not attach any debug location to them. The X86/AArch64/ARM/Thumb
backends all follow this way.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148304

Files:
  llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp


Index: llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
===================================================================
--- llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
+++ llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
@@ -81,9 +81,6 @@
     MachineBasicBlock &MBB, MachineBasicBlock::iterator I, Register SrcReg,
     bool IsKill, int FI, const TargetRegisterClass *RC,
     const TargetRegisterInfo *TRI, Register VReg) const {
-  DebugLoc DL;
-  if (I != MBB.end())
-    DL = I->getDebugLoc();
   MachineFunction *MF = MBB.getParent();
   MachineFrameInfo &MFI = MF->getFrameInfo();
 
@@ -105,7 +102,7 @@
       MachinePointerInfo::getFixedStack(*MF, FI), MachineMemOperand::MOStore,
       MFI.getObjectSize(FI), MFI.getObjectAlign(FI));
 
-  BuildMI(MBB, I, DL, get(Opcode))
+  BuildMI(MBB, I, DebugLoc(), get(Opcode))
       .addReg(SrcReg, getKillRegState(IsKill))
       .addFrameIndex(FI)
       .addImm(0)
@@ -118,9 +115,6 @@
                                               const TargetRegisterClass *RC,
                                               const TargetRegisterInfo *TRI,
                                               Register VReg) const {
-  DebugLoc DL;
-  if (I != MBB.end())
-    DL = I->getDebugLoc();
   MachineFunction *MF = MBB.getParent();
   MachineFrameInfo &MFI = MF->getFrameInfo();
 
@@ -142,7 +136,7 @@
       MachinePointerInfo::getFixedStack(*MF, FI), MachineMemOperand::MOLoad,
       MFI.getObjectSize(FI), MFI.getObjectAlign(FI));
 
-  BuildMI(MBB, I, DL, get(Opcode), DstReg)
+  BuildMI(MBB, I, DebugLoc(), get(Opcode), DstReg)
       .addFrameIndex(FI)
       .addImm(0)
       .addMemOperand(MMO);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148304.513439.patch
Type: text/x-patch
Size: 1654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230414/0861f760/attachment.bin>


More information about the llvm-commits mailing list