[llvm] 0aa201e - [MachineLICM] Assert that locations from debug insts are not lost

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Thu May 28 13:53:55 PDT 2020


Author: Vedant Kumar
Date: 2020-05-28T13:53:40-07:00
New Revision: 0aa201eaf97681f59b72baee6552aa1b9b5c9129

URL: https://github.com/llvm/llvm-project/commit/0aa201eaf97681f59b72baee6552aa1b9b5c9129
DIFF: https://github.com/llvm/llvm-project/commit/0aa201eaf97681f59b72baee6552aa1b9b5c9129.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineLICM.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp
index 2a60858b6de2..98638b9fa737 100644
--- a/llvm/lib/CodeGen/MachineLICM.cpp
+++ b/llvm/lib/CodeGen/MachineLICM.cpp
@@ -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
   // retain its debug location. Doing so would degrade the debugging
   // experience and adversely affect the accuracy of profiling information.
+  assert(!MI->isDebugInstr() && "Should not hoist debug inst");
   MI->setDebugLoc(DebugLoc());
 
   // 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
     // debug information.
+    assert(!I->isDebugInstr() && "Should not sink debug inst");
     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
     // retain its debug location. Doing so would degrade the debugging
     // experience and adversely affect the accuracy of profiling information.
+    assert(!MI->isDebugInstr() && "Should not hoist debug inst");
     MI->setDebugLoc(DebugLoc());
 
     // Update register pressure for BBs from header to this block.


        


More information about the llvm-commits mailing list