[PATCH] D104433: [MCA] [RegisterFile] Allow for skipping Defs with RegID of 0 rather than asserting.

Patrick Holland via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 17 11:53:19 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGdc11d4e6be24: [MCA] [RegisterFile] Allow for skipping Defs with RegID of 0 (rather than… (authored by holland11).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104433/new/

https://reviews.llvm.org/D104433

Files:
  llvm/lib/MCA/HardwareUnits/RegisterFile.cpp


Index: llvm/lib/MCA/HardwareUnits/RegisterFile.cpp
===================================================================
--- llvm/lib/MCA/HardwareUnits/RegisterFile.cpp
+++ llvm/lib/MCA/HardwareUnits/RegisterFile.cpp
@@ -109,7 +109,12 @@
       return;
 
     MCPhysReg RegID = WS.getRegisterID();
-    assert(RegID != 0 && "A write of an invalid register?");
+
+    // This allows InstrPostProcess to remove register Defs
+    // by setting their RegisterID to 0.
+    if (!RegID)
+      continue;
+
     assert(WS.getCyclesLeft() != UNKNOWN_CYCLES &&
            "The number of cycles should be known at this point!");
     assert(WS.getCyclesLeft() <= 0 && "Invalid cycles left for this write!");
@@ -224,7 +229,11 @@
                                     MutableArrayRef<unsigned> UsedPhysRegs) {
   WriteState &WS = *Write.getWriteState();
   MCPhysReg RegID = WS.getRegisterID();
-  assert(RegID && "Adding an invalid register definition?");
+
+  // This allows InstrPostProcess to remove register Defs
+  // by setting their RegisterID to 0.
+  if (!RegID)
+    return;
 
   LLVM_DEBUG({
     dbgs() << "[PRF] addRegisterWrite [ " << Write.getSourceIndex() << ", "
@@ -316,7 +325,11 @@
 
   MCPhysReg RegID = WS.getRegisterID();
 
-  assert(RegID != 0 && "Invalidating an already invalid register?");
+  // This allows InstrPostProcess to remove register Defs
+  // by setting their RegisterID to 0.
+  if (!RegID)
+    return;
+
   assert(WS.getCyclesLeft() != UNKNOWN_CYCLES &&
          "Invalidating a write of unknown cycles!");
   assert(WS.getCyclesLeft() <= 0 && "Invalid cycles left for this write!");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104433.352813.patch
Type: text/x-patch
Size: 1615 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210617/841a3a07/attachment.bin>


More information about the llvm-commits mailing list