mirror of
https://github.com/intel/llvm.git
synced 2026-01-27 14:50:42 +08:00
[CodeGen][DebugInfo] Add missing DebugLoc for SplitCriticalEdge (#72192)
In SplitCriticalEdge, DebugLoc of the branch instruction in new created MBB was set to empty. It should be set and we can find proper DebugLoc for it in most cases. This patch set it to non empty merged DebugLoc of current MBB branches.
This commit is contained in:
@@ -1137,7 +1137,6 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge(
|
||||
|
||||
MachineFunction *MF = getParent();
|
||||
MachineBasicBlock *PrevFallthrough = getNextNode();
|
||||
DebugLoc DL; // FIXME: this is nowhere
|
||||
|
||||
MachineBasicBlock *NMBB = MF->CreateMachineBasicBlock();
|
||||
NMBB->setCallFrameSize(Succ->getCallFrameSize());
|
||||
@@ -1218,6 +1217,15 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge(
|
||||
SlotIndexUpdateDelegate SlotUpdater(*MF, Indexes);
|
||||
SmallVector<MachineOperand, 4> Cond;
|
||||
const TargetInstrInfo *TII = getParent()->getSubtarget().getInstrInfo();
|
||||
|
||||
// In original 'this' BB, there must be a branch instruction targeting at
|
||||
// Succ. We can not find it out since currently getBranchDestBlock was not
|
||||
// implemented for all targets. However, if the merged DL has column or line
|
||||
// number, the scope and non-zero column and line number is same with that
|
||||
// branch instruction so we can safely use it.
|
||||
DebugLoc DL, MergedDL = findBranchDebugLoc();
|
||||
if (MergedDL && (MergedDL.getLine() || MergedDL.getCol()))
|
||||
DL = MergedDL;
|
||||
TII->insertBranch(*NMBB, Succ, nullptr, Cond, DL);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
; V01: .loc 1 9 5 is_stmt 1 discriminator 2 # foo.c:9:5
|
||||
; V0: .loc 1 9 5 is_stmt 0 discriminator 11266 # foo.c:9:5
|
||||
; V0: .loc 1 7 3 is_stmt 1 discriminator 11266 # foo.c:7:3
|
||||
; V1: .loc 1 9 5 is_stmt 0 discriminator 258 # foo.c:9:5
|
||||
; V1: .loc 1 9 5 is_stmt 0 discriminator 514 # foo.c:9:5
|
||||
; V1: .loc 1 7 3 is_stmt 1 discriminator 258 # foo.c:7:3
|
||||
; Check that variable __llvm_fs_discriminator__ is generated.
|
||||
; V01: .type __llvm_fs_discriminator__,@object # @__llvm_fs_discriminator__
|
||||
|
||||
Reference in New Issue
Block a user