[llvm] [MISched](NFC) Factor control dependency construction state and logic out of `buildSchedGraph` (PR #226533)

Tomer Shafir via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 27 07:35:40 PDT 2026


================
@@ -746,33 +718,88 @@ void ScheduleDAGInstrs::buildSchedGraph(AAResults *AA,
   // convenience.
   Value2SUsMap FPExceptions;
 
-  // Remove any stale debug info; sometimes BuildSchedGraph is called again
-  // without emitting the info from the previous call.
-  DbgValues.clear();
-  FirstDbgValue = nullptr;
+  /// For an unanalyzable memory access, this Value is used in maps.
+  UndefValue *UnknownValue;
 
-  assert(Defs.empty() && Uses.empty() &&
-         "Only BuildGraph should update Defs/Uses");
-  Defs.setUniverse(TRI->getNumRegs());
-  Uses.setUniverse(TRI->getNumRegs());
+  /// Remember a generic side-effecting instruction as we proceed.
+  /// No other SU ever gets scheduled around it (except in the special
+  /// case of a huge region that gets reduced).
+  SUnit *BarrierChain = nullptr;
 
-  assert(CurrentVRegDefs.empty() && "nobody else should use CurrentVRegDefs");
-  assert(CurrentVRegUses.empty() && "nobody else should use CurrentVRegUses");
-  unsigned NumVirtRegs = MRI.getNumVirtRegs();
-  CurrentVRegDefs.setUniverse(NumVirtRegs);
-  CurrentVRegUses.setUniverse(NumVirtRegs);
+  unsigned MemOpsProcessed = 0;
+
+public:
+  ScheduleDependencyBuilder(ScheduleDAGInstrs &DAG, BatchAAResults *AA,
----------------
tomershafir wrote:

Outline function member defs, like before?

https://github.com/llvm/llvm-project/pull/226533


More information about the llvm-commits mailing list