Skip to content

Commit a5079e0

Browse files
committed
[SelectionDAG] Fix an incorrect DebugLoc on a COPY
1 parent 1236e1b commit a5079e0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,9 @@ InstrEmitter::AddRegisterOperand(MachineInstrBuilder &MIB,
351351
OpRC = TRI->getAllocatableClass(OpRC);
352352
assert(OpRC && "Constraints cannot be fulfilled for allocation");
353353
Register NewVReg = MRI->createVirtualRegister(OpRC);
354-
BuildMI(*MBB, InsertPos, Op.getNode()->getDebugLoc(),
355-
TII->get(TargetOpcode::COPY), NewVReg).addReg(VReg);
354+
BuildMI(*MBB, InsertPos, MIB->getDebugLoc(),
355+
TII->get(TargetOpcode::COPY), NewVReg)
356+
.addReg(VReg);
356357
VReg = NewVReg;
357358
} else {
358359
assert(ConstrainedRC->isAllocatable() &&

llvm/test/DebugInfo/AMDGPU/debug-loc-copy.ll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ define void @_Z12lane_pc_testj() #0 !dbg !9 {
2626
; GCN-NEXT: s_cselect_b32 s5, s4, s7
2727
; GCN-NEXT: s_cselect_b32 s4, s8, s6
2828
; GCN-NEXT: v_mov_b32_e32 v2, 0
29+
; GCN-NEXT: .loc 0 13 1 ; t.cpp:13:1
2930
; GCN-NEXT: v_mov_b32_e32 v0, s4
3031
; GCN-NEXT: v_mov_b32_e32 v1, s5
31-
; GCN-NEXT: .loc 0 13 1 ; t.cpp:13:1
3232
; GCN-NEXT: flat_store_dword v[0:1], v2
3333
; GCN-NEXT: v_mov_b32_e32 v2, 1
34-
; GCN-NEXT: .loc 0 12 1 ; t.cpp:12:1
34+
; GCN-NEXT: .loc 0 14 1 ; t.cpp:14:1
3535
; GCN-NEXT: v_mov_b32_e32 v0, s4
3636
; GCN-NEXT: v_mov_b32_e32 v1, s5
37-
; GCN-NEXT: .loc 0 14 1 ; t.cpp:14:1
3837
; GCN-NEXT: flat_store_dword v[0:1], v2
3938
; GCN-NEXT: s_waitcnt lgkmcnt(0)
4039
; GCN-NEXT: s_setpc_b64 s[30:31]

0 commit comments

Comments
 (0)