Handle dead defs in the if converter.
authorPete Cooper <peter_cooper@apple.com>
Wed, 6 May 2015 22:51:04 +0000 (22:51 +0000)
committerPete Cooper <peter_cooper@apple.com>
Wed, 6 May 2015 22:51:04 +0000 (22:51 +0000)
commit28b0dda32e64bf6119ac42242c3c7c2717a1424b
tree776a21688c8cfd5451beced3bf3ae576b2ddd9ea
parent8434a039e28c17e9264bbc59a1ab3096bfded166
Handle dead defs in the if converter.

We had code such as this:
  r2 = ...
  t2Bcc

label1:
  ldr ... r2

label2;
  return r2<dead, def>

The if converter was transforming this to
   r2<def> = ...
   return [pred] r2<dead,def>
   ldr <r2, kill>
   return

which fails the machine verifier because the ldr now reads from a dead def.

The fix here detects dead defs in stepForward and passes them back to the caller in the clobbers list.  The caller then clears the dead flag from the def is the value is live.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236660 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/IfConversion.cpp
lib/CodeGen/LivePhysRegs.cpp
test/CodeGen/ARM/ifcvt-dead-def.ll [new file with mode: 0644]