[PATCH] D113015: [CodeGen] Handle dead defs in LivePhysRegs::stepForward

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 2 06:56:41 PDT 2021


foad created this revision.
Herald added a subscriber: hiraditya.
foad requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

LivePhysRegs::stepForward already handled killed uses by removing them
from the set of live registers. This patch makes it handle dead defs in
the same way.

This does not affect any current tests but is required for a forthcoming
change to use LivePhysRegs in ExpandPostRAPseudos.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113015

Files:
  llvm/lib/CodeGen/LivePhysRegs.cpp


Index: llvm/lib/CodeGen/LivePhysRegs.cpp
===================================================================
--- llvm/lib/CodeGen/LivePhysRegs.cpp
+++ llvm/lib/CodeGen/LivePhysRegs.cpp
@@ -88,6 +88,8 @@
       if (!Reg.isPhysical())
         continue;
       if (O->isDef()) {
+        if (O->isDead())
+          removeReg(Reg);
         // Note, dead defs are still recorded.  The caller should decide how to
         // handle them.
         Clobbers.push_back(std::make_pair(Reg, &*O));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113015.384079.patch
Type: text/x-patch
Size: 491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211102/1138f943/attachment.bin>


More information about the llvm-commits mailing list