summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveInterval.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-05-19 05:25:50 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-05-19 05:25:50 +0000
commitbd6f44a3a2a1404721bcbb67edf92b8480a3e655 (patch)
tree490f7e83e476f9d5f4f77205f3a0113c19d3ddd0 /lib/CodeGen/LiveInterval.cpp
parent20942dcd8634ad75091fe89669868cfebf74e869 (diff)
downloadllvm-bd6f44a3a2a1404721bcbb67edf92b8480a3e655.tar.gz
llvm-bd6f44a3a2a1404721bcbb67edf92b8480a3e655.tar.bz2
llvm-bd6f44a3a2a1404721bcbb67edf92b8480a3e655.tar.xz
Run proper recursive dead code elimination during coalescing.
Dead copies cause problems because they are trivial to coalesce, but removing them gived the live range a dangling end point. This patch enables full dead code elimination which trims live ranges to their uses so end points don't dangle. DCE may erase multiple instructions. Put the pointers in an ErasedInstrs set so we never risk visiting erased instructions in the work list. There isn't supposed to be any dead copies entering RegisterCoalescer, but they do slip by as evidenced by test/CodeGen/X86/coalescer-dce.ll. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157101 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveInterval.cpp')
-rw-r--r--lib/CodeGen/LiveInterval.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp
index aa44d3738e..010ef48f5c 100644
--- a/lib/CodeGen/LiveInterval.cpp
+++ b/lib/CodeGen/LiveInterval.cpp
@@ -681,7 +681,10 @@ void ConnectedVNInfoEqClasses::Distribute(LiveInterval *LIV[],
SlotIndex Idx = LIS.getInstructionIndex(MI);
Idx = Idx.getRegSlot(MO.isUse());
const VNInfo *VNI = LI.getVNInfoAt(Idx);
- assert(VNI && "Interval not live at use.");
+ // FIXME: We should be able to assert(VNI) here, but the coalescer leaves
+ // dangling defs around.
+ if (!VNI)
+ continue;
MO.setReg(LIV[getEqClass(VNI)]->reg);
}