Skip to content

Commit 39569cc

Browse files
committed
Closes #16
1 parent 59bd652 commit 39569cc

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

llvm/include/llvm/CodeGen/LiveInterval.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ namespace llvm {
542542
// Find the segment that enters the instruction.
543543
const_iterator I = find(Idx.getBaseIndex());
544544
const_iterator E = end();
545-
if (I == E)
545+
if (I == E || !I->valno)
546546
return LiveQueryResult(nullptr, nullptr, SlotIndex(), false);
547547

548548
// Is this an instruction live-in segment?

llvm/lib/CodeGen/RegisterCoalescer.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,8 @@ bool RegisterCoalescer::adjustCopiesBackFrom(const CoalescerPair &CP,
648648
// The live segment might not exist after fun with physreg coalescing.
649649
if (AS == IntA.end()) return false;
650650
VNInfo *AValNo = AS->valno;
651-
651+
if (!AValNo)
652+
return false;
652653
// If AValNo is defined as a copy from IntB, we can potentially process this.
653654
// Get the instruction that defines this value number.
654655
MachineInstr *ACopyMI = LIS->getInstructionFromIndex(AValNo->def);
@@ -832,6 +833,8 @@ RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP,
832833

833834
// AValNo is the value number in A that defines the copy, A3 in the example.
834835
VNInfo *AValNo = IntA.getVNInfoAt(CopyIdx.getRegSlot(true));
836+
if (!AValNo)
837+
return {false, false};
835838
assert(AValNo && !AValNo->isUnused() && "COPY source not live");
836839
if (AValNo->isPHIDef())
837840
return { false, false };
@@ -2728,6 +2731,8 @@ JoinVals::analyzeValue(unsigned ValNo, JoinVals &Other) {
27282731

27292732
// Find the value in Other that overlaps VNI->def, if any.
27302733
LiveQueryResult OtherLRQ = Other.LR.Query(VNI->def);
2734+
if (!OtherLRQ.valueIn() && !OtherLRQ.valueOutOrDead() && !OtherLRQ.isKill())
2735+
return CR_Impossible;
27312736

27322737
// It is possible that both values are defined by the same instruction, or
27332738
// the values are PHIs defined in the same block. When that happens, the two

0 commit comments

Comments
 (0)