summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2015-01-10 21:49:36 +0000
committerJoerg Sonnenberger <joerg@bec.de>2015-01-10 21:49:36 +0000
commit8a36a8e5d41eafcfe0814335108ff8f9b476d447 (patch)
tree216d2921a99891e3b5ba3582c476c247995ba090 /llvm/lib/CodeGen
parent94a4cc027ab111f6055c81605b3a47caae46cbe6 (diff)
downloadbcm5719-llvm-8a36a8e5d41eafcfe0814335108ff8f9b476d447.tar.gz
bcm5719-llvm-8a36a8e5d41eafcfe0814335108ff8f9b476d447.zip
Revert r225500, it leads to infinite loops.
llvm-svn: 225590
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/RegisterCoalescer.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp
index bce469c2322..d58faf65f19 100644
--- a/llvm/lib/CodeGen/RegisterCoalescer.cpp
+++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp
@@ -621,12 +621,13 @@ bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP,
// the example above.
SlotIndex CopyIdx = LIS->getInstructionIndex(CopyMI).getRegSlot();
VNInfo *BValNo = IntB.getVNInfoAt(CopyIdx);
- assert(BValNo != nullptr && BValNo->def == CopyIdx);
+ if (!BValNo || BValNo->def != CopyIdx)
+ return false;
// AValNo is the value number in A that defines the copy, A3 in the example.
VNInfo *AValNo = IntA.getVNInfoAt(CopyIdx.getRegSlot(true));
- assert(AValNo && !AValNo->isUnused() && "COPY source not live");
- if (AValNo->isPHIDef())
+ assert(AValNo && "COPY source not live");
+ if (AValNo->isPHIDef() || AValNo->isUnused())
return false;
MachineInstr *DefMI = LIS->getInstructionFromIndex(AValNo->def);
if (!DefMI)
@@ -708,8 +709,6 @@ bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP,
UE = MRI->use_end();
UI != UE;) {
MachineOperand &UseMO = *UI;
- if (UseMO.isUndef())
- continue;
MachineInstr *UseMI = UseMO.getParent();
++UI;
if (UseMI->isDebugValue()) {
@@ -720,8 +719,7 @@ bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP,
}
SlotIndex UseIdx = LIS->getInstructionIndex(UseMI).getRegSlot(true);
LiveInterval::iterator US = IntA.FindSegmentContaining(UseIdx);
- assert(US != IntA.end() && "Use must be live");
- if (US->valno != AValNo)
+ if (US == IntA.end() || US->valno != AValNo)
continue;
// Kill flags are no longer accurate. They are recomputed after RA.
UseMO.setIsKill(false);
@@ -772,7 +770,11 @@ bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP,
SlotIndex AIdx = CopyIdx.getRegSlot(true);
for (LiveInterval::SubRange &SA : IntA.subranges()) {
VNInfo *ASubValNo = SA.getVNInfoAt(AIdx);
- assert(ASubValNo != nullptr);
+ if (ASubValNo == nullptr) {
+ DEBUG(dbgs() << "No A Range at " << AIdx << " with mask "
+ << format("%04X", SA.LaneMask) << "\n");
+ continue;
+ }
unsigned AMask = SA.LaneMask;
for (LiveInterval::SubRange &SB : IntB.subranges()) {
@@ -824,7 +826,11 @@ bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP,
SlotIndex AIdx = CopyIdx.getRegSlot(true);
for (LiveInterval::SubRange &SA : IntA.subranges()) {
VNInfo *ASubValNo = SA.getVNInfoAt(AIdx);
- assert(ASubValNo != nullptr);
+ if (ASubValNo == nullptr) {
+ DEBUG(dbgs() << "No A Range at " << AIdx << " with mask "
+ << format("%04X", SA.LaneMask) << "\n");
+ continue;
+ }
SA.removeValNo(ASubValNo);
}
}
OpenPOWER on IntegriCloud