bug fix for PR20020: anti-dependency-breaker causes miscompilation
authorSanjay Patel <spatel@rotateright.com>
Thu, 3 Jul 2014 15:19:40 +0000 (15:19 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 3 Jul 2014 15:19:40 +0000 (15:19 +0000)
commit1a699b68339c336dc26de2d3254e0eb90a7cae14
tree6db7e5c51778882dfbf40db9b2ac46e3240b08cd
parent1ef2cec146099f4bf46c31b913c7f1538935a867
bug fix for PR20020: anti-dependency-breaker causes miscompilation

This patch sets the 'KeepReg' bit for any tied and live registers during the PrescanInstruction() phase of the dependency breaking algorithm. It then checks those 'KeepReg' bits during the ScanInstruction() phase to avoid changing any tied registers. For more details, please see comments in:
http://llvm.org/bugs/show_bug.cgi?id=20020

I added two FIXME comments for code that I think can be removed by using register iterators that include self. I don't want to include those code changes with this patch, however, to keep things as small as possible.

The test case is larger than I'd like, but I don't know how to reduce it further and still produce the failing asm.

Differential Revision: http://reviews.llvm.org/D4351

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212275 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CriticalAntiDepBreaker.cpp
test/CodeGen/X86/pr20020.ll [new file with mode: 0644]