[PATCH] D37611: [IfConversion] More simple, correct dead/kill liveness handling

Jesper Antonsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 14 07:43:33 PDT 2017


JesperAntonsson updated this revision to Diff 115215.
JesperAntonsson edited the summary of this revision.
JesperAntonsson added a comment.

I found and fixed the reason our randomized tests didn't run cleanly. It was essentially that stepBackwards removed defined regs from the set even if the instruction was predicated. That meant a dominating def could be marked dead, which is wrong. The reason I found this is that I use the new recompute function also in a later stage in our out-of-tree backend, and that went bad when I started to add faulty deads. If I understand it correctly, this is a bug in the current implementation of LivePhysRegs.

I fixed this by adding an early return to removeDefs() if the instruction is predicated. NB this does not recognize that a sequence of predicated instructions may combine to define a reg with certainty. Thus we might miss an opportunity to determine a reg isn't live just before such a sequence and even remove such information if it was there beforehand. I think this has low impact, though.


https://reviews.llvm.org/D37611

Files:
  include/llvm/CodeGen/LivePhysRegs.h
  lib/CodeGen/IfConversion.cpp
  lib/CodeGen/LivePhysRegs.cpp
  test/CodeGen/Hexagon/branch-folder-hoist-kills.mir
  test/CodeGen/Hexagon/ifcvt-live-subreg.mir
  test/CodeGen/Hexagon/livephysregs-add-pristines.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37611.115215.patch
Type: text/x-patch
Size: 11609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170914/fe67b94d/attachment.bin>


More information about the llvm-commits mailing list