Skip to content

Commit 1cd822a

Browse files
committed
[SelectionDAG] Fix an incorrect DebugLoc on a COPY
1 parent c8292a1 commit 1cd822a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ 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(),
354+
BuildMI(*MBB, InsertPos, MIB->getDebugLoc(),
355355
TII->get(TargetOpcode::COPY), NewVReg).addReg(VReg);
356356
VReg = NewVReg;
357357
} else {

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

+2-3
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_add_i32 s32, s32, 0xffffff00
4039
; GCN-NEXT: s_mov_b32 s33, s9

0 commit comments

Comments
 (0)