[llvm] 0478723 - [LiveVariables] Skip verification of kills inside bundles

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 1 10:16:15 PDT 2021


Author: Jay Foad
Date: 2021-10-01T18:15:57+01:00
New Revision: 04787239c930c386105d341a172b1d419c42fa9c

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

LOG: [LiveVariables] Skip verification of kills inside bundles

LiveVariables does not examine the contents of bundles, so
MachineVerifier should not expect it to know about kill flags on
operands of instructions inside a bundle.

With this fix we can enable machine verification after running the
LiveVariables analysis. Doing this does not show any problems in
check-llvm in an LLVM_ENABLE_EXPENSIVE_CHECKS build.

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineVerifier.cpp
    llvm/lib/CodeGen/TargetPassConfig.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index a553b677237b..7295773b5c65 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -2211,8 +2211,11 @@ void MachineVerifier::checkLiveness(const MachineOperand *MO, unsigned MONum) {
     if (MO->isKill())
       addRegWithSubRegs(regsKilled, Reg);
 
-    // Check that LiveVars knows this kill.
-    if (LiveVars && Register::isVirtualRegister(Reg) && MO->isKill()) {
+    // Check that LiveVars knows this kill (unless we are inside a bundle, in
+    // which case we have already checked that LiveVars knows any kills on the
+    // bundle header instead).
+    if (LiveVars && Register::isVirtualRegister(Reg) && MO->isKill() &&
+        !MI->isBundledWithPred()) {
       LiveVariables::VarInfo &VI = LiveVars->getVarInfo(Reg);
       if (!is_contained(VI.Kills, MI))
         report("Kill missing from LiveVariables", MO, MONum);

diff  --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp
index a6cdd83f6c5f..09d66a89e36c 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -1442,7 +1442,7 @@ void TargetPassConfig::addOptimizedRegAlloc() {
   // Explicit addition of UnreachableMachineBlockElim allows stopping before or
   // after it with -stop-before/-stop-after.
   addPass(&UnreachableMachineBlockElimID);
-  addPass(&LiveVariablesID, false);
+  addPass(&LiveVariablesID);
 
   // Edge splitting is smarter with machine loop info.
   addPass(&MachineLoopInfoID, false);


        


More information about the llvm-commits mailing list