summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorNicolai Haehnle <nhaehnle@gmail.com>2016-08-10 18:51:14 +0000
committerNicolai Haehnle <nhaehnle@gmail.com>2016-08-10 18:51:14 +0000
commit02d784172c40325a12e481b4ffcb0618dcd13e78 (patch)
tree72d191876a5c2ad211d8ea5ab2302fe3ef5a8009 /llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
parentb10f6876cd7353d1e3fe2b13cf3f0e8171d8335f (diff)
downloadbcm5719-llvm-02d784172c40325a12e481b4ffcb0618dcd13e78.tar.gz
bcm5719-llvm-02d784172c40325a12e481b4ffcb0618dcd13e78.zip
LiveIntervalAnalysis: fix a crash in repairOldRegInRange
Summary: See the new test case for one that was (non-deterministically) crashing on trunk and deterministically hit the assertion that I added in D23302. Basically, the machine function contains a sequence DS_WRITE_B32 %vreg4, %vreg14:sub0, ... DS_WRITE_B32 %vreg4, %vreg14:sub0, ... %vreg14:sub1<def> = COPY %vreg14:sub0 and SILoadStoreOptimizer::mergeWrite2Pair merges the two DS_WRITE_B32 instructions into one before calling repairIntervalsInRange. Now repairIntervalsInRange wants to repair %vreg14, in particular, and ends up trying to repair %vreg14:sub1 as well, but that only becomes active _after_ the range that is to be repaired, hence the crash due to LR.find(...) == LR.begin() at the start of repairOldRegInRange. I believe that just skipping those subrange is fine, but again, not too familiar with that code. Reviewers: MatzeB, kparzysz, tstellarAMD Subscribers: llvm-commits, MatzeB Differential Revision: https://reviews.llvm.org/D23303 llvm-svn: 278268
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index 8fd0585f976..26b5cba3294 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -1396,6 +1396,11 @@ void LiveIntervals::repairOldRegInRange(const MachineBasicBlock::iterator Begin,
LaneBitmask LaneMask) {
LiveInterval::iterator LII = LR.find(endIdx);
SlotIndex lastUseIdx;
+ if (LII == LR.begin()) {
+ // This happens when the function is called for a subregister that only
+ // occurs _after_ the range that is to be repaired.
+ return;
+ }
if (LII != LR.end() && LII->start < endIdx)
lastUseIdx = LII->end;
else
OpenPOWER on IntegriCloud