[llvm] 06fd423 - [LoongArch] Use empty debug location for register spill/reload

Ben Shi via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 15 20:07:32 PDT 2023


Author: Ben Shi
Date: 2023-04-16T11:07:22+08:00
New Revision: 06fd423de16b8b362ce902704ca061556c4146b4

URL: https://github.com/llvm/llvm-project/commit/06fd423de16b8b362ce902704ca061556c4146b4
DIFF: https://github.com/llvm/llvm-project/commit/06fd423de16b8b362ce902704ca061556c4146b4.diff

LOG: [LoongArch] Use empty debug location for register spill/reload

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.

Reviewed By: xen0n

Differential Revision: https://reviews.llvm.org/D148304

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp b/llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
index 3e19f3e2fe08..a7c5e4d91847 100644
--- a/llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
@@ -81,9 +81,6 @@ void LoongArchInstrInfo::storeRegToStackSlot(
     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 @@ void LoongArchInstrInfo::storeRegToStackSlot(
       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 @@ void LoongArchInstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
                                               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 @@ void LoongArchInstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
       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);


        


More information about the llvm-commits mailing list