[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.
This commit is contained in:
HaohaiWen 2024-01-11 22:10:56 +08:00 committed by GitHub
parent f892cc36fd
commit 52613396a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.