Correctly deal with identity copies in RegisterCoalescer.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 23 May 2012 20:21:06 +0000 (20:21 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Wed, 23 May 2012 20:21:06 +0000 (20:21 +0000)
commit5b8f476037f38b91263f693b83bfce740622f0d2
treee57fb6730b55a1d9c20216f72e8e47bcd36b2ff2
parent4ab452d061a185a527a7cc09d2dc47ec77d9bcd8
Correctly deal with identity copies in RegisterCoalescer.

Now that the coalescer keeps live intervals and machine code in sync at
all times, it needs to deal with identity copies differently.

When merging two virtual registers, all identity copies are removed
right away. This means that other identity copies must come from
somewhere else, and they are going to have a value number.

Deal with such copies by merging the value numbers before erasing the
copy instruction. Otherwise, we leave dangling value numbers in the live
interval.

This fixes PR12927.

llvm-svn: 157340
llvm/lib/CodeGen/RegisterCoalescer.cpp
llvm/test/CodeGen/X86/coalescer-identity.ll [new file with mode: 0644]