[MachineLICM] Assert that locations from debug insts are not lost

Summary:
Assert that MachineLICM does not move a debug instruction and then drop
its debug location. Later passes require each debug instruction to have
a location.

Testing: check-llvm, clang stage2 RelWithDebInfo build (x86_64)

Reviewers: aprantl, davide, chrisjackson, jmorse

Subscribers: hiraditya, asbirlea, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80665
This commit is contained in:
Vedant Kumar 2020-05-27 13:13:13 -07:00
parent 9d06547794
commit 0aa201eaf9
1 changed files with 3 additions and 0 deletions

View File

@ -638,6 +638,7 @@ void MachineLICMBase::HoistPostRA(MachineInstr *MI, unsigned Def) {
// Since we are moving the instruction out of its basic block, we do not // Since we are moving the instruction out of its basic block, we do not
// retain its debug location. Doing so would degrade the debugging // retain its debug location. Doing so would degrade the debugging
// experience and adversely affect the accuracy of profiling information. // experience and adversely affect the accuracy of profiling information.
assert(!MI->isDebugInstr() && "Should not hoist debug inst");
MI->setDebugLoc(DebugLoc()); MI->setDebugLoc(DebugLoc());
// Add register to livein list to all the BBs in the current loop since a // Add register to livein list to all the BBs in the current loop since a
@ -841,6 +842,7 @@ void MachineLICMBase::SinkIntoLoop() {
// The instruction is is moved from its basic block, so do not retain the // The instruction is is moved from its basic block, so do not retain the
// debug information. // debug information.
assert(!I->isDebugInstr() && "Should not sink debug inst");
I->setDebugLoc(DebugLoc()); I->setDebugLoc(DebugLoc());
} }
} }
@ -1536,6 +1538,7 @@ bool MachineLICMBase::Hoist(MachineInstr *MI, MachineBasicBlock *Preheader) {
// Since we are moving the instruction out of its basic block, we do not // Since we are moving the instruction out of its basic block, we do not
// retain its debug location. Doing so would degrade the debugging // retain its debug location. Doing so would degrade the debugging
// experience and adversely affect the accuracy of profiling information. // experience and adversely affect the accuracy of profiling information.
assert(!MI->isDebugInstr() && "Should not hoist debug inst");
MI->setDebugLoc(DebugLoc()); MI->setDebugLoc(DebugLoc());
// Update register pressure for BBs from header to this block. // Update register pressure for BBs from header to this block.