[PATCH] D145673: [llvm][CodeGen] Prevent endless loop when running the post-RA-sched pass.

Xiaoqiang Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 01:35:12 PST 2023


csstormq created this revision.
csstormq added a reviewer: atrick.
csstormq added a project: LLVM.
Herald added a subscriber: hiraditya.
Herald added a project: All.
csstormq requested review of this revision.

Skip the stage that no functional units are required in ScoreboardHazardRecognizer::getHazardType. If not, this function will always return Hazard by default, leading to endless loop when running the post-RA-sched pass.

Although this problem only occurs in our downstream fork, it's completely general.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145673

Files:
  llvm/lib/CodeGen/ScoreboardHazardRecognizer.cpp


Index: llvm/lib/CodeGen/ScoreboardHazardRecognizer.cpp
===================================================================
--- llvm/lib/CodeGen/ScoreboardHazardRecognizer.cpp
+++ llvm/lib/CodeGen/ScoreboardHazardRecognizer.cpp
@@ -143,6 +143,13 @@
       }
 
       InstrStage::FuncUnits freeUnits = IS->getUnits();
+      if (!freeUnits) {
+        // No functional units are required by this stage, so cannot conflict.
+        // In addition, prevent endless loop when running the post-RA-sched
+        // pass.
+        continue;
+      }
+
       switch (IS->getReservationKind()) {
       case InstrStage::Required:
         // Required FUs conflict with both reserved and required ones


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145673.503679.patch
Type: text/x-patch
Size: 694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230309/f84d5a33/attachment-0001.bin>


More information about the llvm-commits mailing list