[llvm] ee58f49 - Change if() continue; to an assert if a DBG_VALUE or DBG_VALUE_LIST returns a null DILocalVariable

Shubham Sandeep Rastogi via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 14:19:42 PDT 2023


Author: Shubham Sandeep Rastogi
Date: 2023-05-03T14:19:20-07:00
New Revision: ee58f49a786d5d0823eb840df87eafc6aa01f7d1

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

LOG: Change if() continue; to an assert if a DBG_VALUE or DBG_VALUE_LIST returns a null DILocalVariable

A  DBG_VALUE or DBG_VALUE_LIST must always return a non-null
DILocalVariable, the ARMLoadStoreOptimizer code that move’s DBG_VALUE
and DBG_VALUE_LIST instructions if their corresponding loads have been
moved, currently just continues if it finds a DBG_VALUE or
DBG_VALUE_LIST with a null DILocalVariable, change that to an assert.

Differential revision: https://reviews.llvm.org/D149762

Added: 
    

Modified: 
    llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp b/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
index fd24f2abd57de..94212b64ae431 100644
--- a/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
+++ b/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
@@ -2798,10 +2798,9 @@ ARMPreAllocLoadStoreOpt::RescheduleLoadStoreInstrs(MachineBasicBlock *MBB) {
 
     if (MI.isDebugValue()) {
       auto *DILocalVar = MI.getDebugVariable();
-      // TODO: This should not happen, have to fix the MIR verifier to check for
-      // such instances and fix them.
-      if (!DILocalVar)
-        continue;
+      assert(DILocalVar &&
+             "DBG_VALUE or DBG_VALUE_LIST must contain a DILocalVariable");
+
       auto DbgVar = createDebugVariableFromMachineInstr(&MI);
       // If the first operand is a register and it exists in the RegisterMap, we
       // know this is a DBG_VALUE that uses the result of a load that was moved,


        


More information about the llvm-commits mailing list