Avoid creating dangling physreg live ranges during DCE.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 2 Aug 2012 16:36:47 +0000 (16:36 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 2 Aug 2012 16:36:47 +0000 (16:36 +0000)
commite2b83ab056836067e2c86ef22223a4c29fe267ce
treef0b8958b61d67b64aa67ba60dad7fc30f64861a7
parent28897ca434892340f2e188a0331db92d5899409b
Avoid creating dangling physreg live ranges during DCE.

LiveRangeEdit::eliminateDeadDefs() can delete a dead instruction that
reads unreserved physregs. This would leave the corresponding regunit
live interval dangling because we don't have shrinkToUses() for physical
registers.

Fix this problem by turning the instruction into a KILL instead of
deleting it. This happens in a landing pad in
test/CodeGen/X86/2012-05-19-CoalescerCrash.ll:

  %vreg27<def,dead> = COPY %EDX<kill>; GR32:%vreg27

becomes:

  KILL %EDX<kill>

An upcoming fix to the machine verifier will catch problems like this by
verifying regunit live intervals.

This fixes PR13498. I am not including the test case from the PR since
we already have one exposing the problem once the verifier is fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161182 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/LiveRangeEdit.cpp