[PATCH] D110939: [PHIElimination] Update LiveVariables after handling an unspillable terminator

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 1 07:51:40 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.

Update the LiveVariables analysis after the special handling for
unspillable terminators which was added in D91358 <https://reviews.llvm.org/D91358>. This is just enough
to fix some "Block should not be in AliveBlocks" / "Block missing from
AliveBlocks" errors in the codegen test suite when machine verification
is forced to run after PHIElimination (currently it is disabled).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110939

Files:
  llvm/lib/CodeGen/PHIElimination.cpp


Index: llvm/lib/CodeGen/PHIElimination.cpp
===================================================================
--- llvm/lib/CodeGen/PHIElimination.cpp
+++ llvm/lib/CodeGen/PHIElimination.cpp
@@ -461,6 +461,15 @@
       assert(MRI->use_empty(SrcReg) &&
              "Expected a single use from UnspillableTerminator");
       SrcRegDef->getOperand(0).setReg(IncomingReg);
+
+      // Update LiveVariables.
+      if (LV) {
+        LiveVariables::VarInfo &SrcVI = LV->getVarInfo(SrcReg);
+        LiveVariables::VarInfo &IncomingVI = LV->getVarInfo(IncomingReg);
+        IncomingVI.AliveBlocks = std::move(SrcVI.AliveBlocks);
+        SrcVI.AliveBlocks.clear();
+      }
+
       continue;
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110939.376541.patch
Type: text/x-patch
Size: 700 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211001/e24dc26d/attachment.bin>


More information about the llvm-commits mailing list