[llvm] f65458d - [PHIElimination] Update LiveVariables after handling an unspillable terminator

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 06:25:58 PDT 2021


Author: Jay Foad
Date: 2021-10-05T14:25:53+01:00
New Revision: f65458df32f72d6c2cb0cdf42544576290e5d8c6

URL: https://github.com/llvm/llvm-project/commit/f65458df32f72d6c2cb0cdf42544576290e5d8c6
DIFF: https://github.com/llvm/llvm-project/commit/f65458df32f72d6c2cb0cdf42544576290e5d8c6.diff

LOG: [PHIElimination] Update LiveVariables after handling an unspillable terminator

Update the LiveVariables analysis after the special handling for
unspillable terminators which was added in 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).

Differential Revision: https://reviews.llvm.org/D110939

Added: 
    

Modified: 
    llvm/lib/CodeGen/PHIElimination.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp
index 54805584dbc1..21d4baed3397 100644
--- a/llvm/lib/CodeGen/PHIElimination.cpp
+++ b/llvm/lib/CodeGen/PHIElimination.cpp
@@ -461,6 +461,15 @@ void PHIElimination::LowerPHINode(MachineBasicBlock &MBB,
       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;
     }
 


        


More information about the llvm-commits mailing list