[llvm] [AMDGPU] Track DS prefetch flush points on single-path loop. (PR #227274)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 01:23:42 PDT 2026


================
@@ -3261,6 +3261,37 @@ bool SIInsertWaitcnts::mayStoreIncrementingDSCNT(const MachineInstr &MI) const {
   return MI.mayStore() && SIInstrInfo::isDS(MI);
 }
 
+// Issue order when the body has no in-loop branch: header, then each block's
+// one in-loop successor. Returns false if that walk is not the whole loop.
+static bool
+appendSinglePathLoopBlocks(const MachineLoop &ML,
+                           SmallVectorImpl<MachineBasicBlock *> &Order) {
+  MachineBasicBlock *Header = ML.getHeader();
+  if (!Header)
+    return false;
+
+  MachineBasicBlock *BB = Header;
+  SmallPtrSet<MachineBasicBlock *, 8> Seen;
+  do {
----------------
Pierre-vh wrote:

This pass performs a dataflow analysis, doing this kind of CFG walk here is not ideal.
If this type of CFG walk is needed and there is no alternative, I think it should either be cleanly abstracted-away into a utility function somewhere, or be done in a separate earlier pass and the information stored somewhere. 

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


More information about the llvm-commits mailing list