Skip to content

Commit 06fd423

Browse files
committed
[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
1 parent 9ee16eb commit 06fd423

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ void LoongArchInstrInfo::storeRegToStackSlot(
8181
MachineBasicBlock &MBB, MachineBasicBlock::iterator I, Register SrcReg,
8282
bool IsKill, int FI, const TargetRegisterClass *RC,
8383
const TargetRegisterInfo *TRI, Register VReg) const {
84-
DebugLoc DL;
85-
if (I != MBB.end())
86-
DL = I->getDebugLoc();
8784
MachineFunction *MF = MBB.getParent();
8885
MachineFrameInfo &MFI = MF->getFrameInfo();
8986

@@ -105,7 +102,7 @@ void LoongArchInstrInfo::storeRegToStackSlot(
105102
MachinePointerInfo::getFixedStack(*MF, FI), MachineMemOperand::MOStore,
106103
MFI.getObjectSize(FI), MFI.getObjectAlign(FI));
107104

108-
BuildMI(MBB, I, DL, get(Opcode))
105+
BuildMI(MBB, I, DebugLoc(), get(Opcode))
109106
.addReg(SrcReg, getKillRegState(IsKill))
110107
.addFrameIndex(FI)
111108
.addImm(0)
@@ -118,9 +115,6 @@ void LoongArchInstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
118115
const TargetRegisterClass *RC,
119116
const TargetRegisterInfo *TRI,
120117
Register VReg) const {
121-
DebugLoc DL;
122-
if (I != MBB.end())
123-
DL = I->getDebugLoc();
124118
MachineFunction *MF = MBB.getParent();
125119
MachineFrameInfo &MFI = MF->getFrameInfo();
126120

@@ -142,7 +136,7 @@ void LoongArchInstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
142136
MachinePointerInfo::getFixedStack(*MF, FI), MachineMemOperand::MOLoad,
143137
MFI.getObjectSize(FI), MFI.getObjectAlign(FI));
144138

145-
BuildMI(MBB, I, DL, get(Opcode), DstReg)
139+
BuildMI(MBB, I, DebugLoc(), get(Opcode), DstReg)
146140
.addFrameIndex(FI)
147141
.addImm(0)
148142
.addMemOperand(MMO);

0 commit comments

Comments
 (0)