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

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 20:34:25 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-debuginfo

Author: None (HaohaiWen)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/77725.diff


1 Files Affected:

- (modified) llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp (+8-1) 


``````````diff
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.

``````````

</details>


https://github.com/llvm/llvm-project/pull/77725


More information about the llvm-commits mailing list