[llvm] 5261339 - [InstrRef] Add debug hint for not reachable blocks from entry (#77725)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 06:11:00 PST 2024


Author: HaohaiWen
Date: 2024-01-11T22:10:56+08:00
New Revision: 52613396a6837e5c8b8334821022cad70fe8e917

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

LOG: [InstrRef] Add debug hint for not reachable blocks from entry (#77725)

Those not reachable blocks was not analyzed by LiveDebugValues and may
raise out of bound access to VarLocs as case in #77441.

Added: 
    

Modified: 
    llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index 9037f752dc4f36..cfc8c28b99e562 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -2403,8 +2403,15 @@ bool InstrRefBasedLDV::mlocJoin(
   llvm::sort(BlockOrders, Cmp);
 
   // Skip entry block.
-  if (BlockOrders.size() == 0)
+  if (BlockOrders.size() == 0) {
+    // FIXME: We don't use assert here to prevent instr-ref-unreachable.mir
+    // failing.
+    LLVM_DEBUG(if (!MBB.isEntryBlock()) dbgs()
+               << "Found not reachable block " << MBB.getFullName()
+               << " from entry which may lead out of "
+                  "bound access to VarLocs\n");
     return false;
+  }
 
   // Step through all machine locations, look at each predecessor and test
   // whether we can eliminate redundant PHIs.


        


More information about the llvm-commits mailing list