summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorWalter Lee <waltl@google.com>2018-09-20 20:05:57 +0000
committerWalter Lee <waltl@google.com>2018-09-20 20:05:57 +0000
commitf75e8036790bae267265b4b1f05416860bfb0a55 (patch)
tree886b69edd0b5012d4f7908bd1ea59ef6ccfc2b6f /llvm/lib/CodeGen
parent4e0295bed380bd666b5c26491fa6d069703742c9 (diff)
downloadbcm5719-llvm-f75e8036790bae267265b4b1f05416860bfb0a55.tar.gz
bcm5719-llvm-f75e8036790bae267265b4b1f05416860bfb0a55.zip
[RegAllocGreedy] Fix crash in tryLocalSplit
tryLocalSplit only handles a single use block, but an interval may have multiple use blocks. So don't crash in that case. This fixes PR38795. Differential revision: https://reviews.llvm.org/D52277 llvm-svn: 342682
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/RegAllocGreedy.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index 5f1f28ff1ad..54f800832d2 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -2188,7 +2188,11 @@ void RAGreedy::calcGapWeights(unsigned PhysReg,
///
unsigned RAGreedy::tryLocalSplit(LiveInterval &VirtReg, AllocationOrder &Order,
SmallVectorImpl<unsigned> &NewVRegs) {
- assert(SA->getUseBlocks().size() == 1 && "Not a local interval");
+ // TODO: the function currently only handles a single UseBlock; it should be
+ // possible to generalize.
+ if (SA->getUseBlocks().size() != 1)
+ return 0;
+
const SplitAnalysis::BlockInfo &BI = SA->getUseBlocks().front();
// Note that it is possible to have an interval that is live-in or live-out
OpenPOWER on IntegriCloud