critical-anti-dependency breaker: don't use reg def info from kill insts (PR20308)
authorSanjay Patel <spatel@rotateright.com>
Wed, 20 Aug 2014 18:03:00 +0000 (18:03 +0000)
committerSanjay Patel <spatel@rotateright.com>
Wed, 20 Aug 2014 18:03:00 +0000 (18:03 +0000)
commit3deb3e32b29ab72b793d6655d4827c31819fd306
treed74853676b5fdeaee3edab4344e1fcdb640e3f50
parentdcd3cbea545253df6ba196e3a66decf06fc3f88d
critical-anti-dependency breaker: don't use reg def info from kill insts (PR20308)

In PR20308 ( http://llvm.org/bugs/show_bug.cgi?id=20308 ), the critical-anti-dependency breaker
caused a miscompile because it broke a WAR hazard using a register that it thinks is available
based on info from a kill inst. Until PR18663 is solved, we shouldn't use any def/use info from
a kill because they are really just nops.

This patch adds guard checks for kills around calls to ScanInstruction() where the DefIndices
array is set. For good measure, add an assert in ScanInstruction() so we don't hit this bug again.

The test case is a reduced version of the code from the bug report.

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

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