[PATCH] D118124: [regalloc] Fix assertion error when LiveInterval is empty
Wang Pengcheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 25 04:17:42 PST 2022
pcwang-thead created this revision.
pcwang-thead added reviewers: asb, craig.topper, jrtc27.
Herald added subscribers: hiraditya, qcolombet, MatzeB.
pcwang-thead requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
When evicting interference, it causes an asseertion error
since LiveIntervals::intervalIsInOneMBB assumes that input
is not empty.
This patch fixed bug mentioned in D118020 <https://reviews.llvm.org/D118020>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118124
Files:
llvm/lib/CodeGen/LiveIntervals.cpp
llvm/lib/CodeGen/RegAllocGreedy.cpp
Index: llvm/lib/CodeGen/RegAllocGreedy.cpp
===================================================================
--- llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -497,7 +497,7 @@
if (Matrix->checkInterference(VirtReg, PhysReg) > LiveRegMatrix::IK_VirtReg)
return false;
- bool IsLocal = LIS->intervalIsInOneMBB(VirtReg);
+ bool IsLocal = VirtReg.empty() || LIS->intervalIsInOneMBB(VirtReg);
// Find VirtReg's cascade number. This will be unassigned if VirtReg was never
// involved in an eviction before. If a cascade number was assigned, deny
Index: llvm/lib/CodeGen/LiveIntervals.cpp
===================================================================
--- llvm/lib/CodeGen/LiveIntervals.cpp
+++ llvm/lib/CodeGen/LiveIntervals.cpp
@@ -827,6 +827,8 @@
MachineBasicBlock*
LiveIntervals::intervalIsInOneMBB(const LiveInterval &LI) const {
+ assert(!LI.empty() && "LiveInterval is empty.");
+
// A local live range must be fully contained inside the block, meaning it is
// defined and killed at instructions, not at block boundaries. It is not
// live in or out of any block.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118124.402841.patch
Type: text/x-patch
Size: 1140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220125/423c1f44/attachment.bin>
More information about the llvm-commits
mailing list