================
@@ -2439,6 +2597,68 @@ bool WaitcntBrackets::mergeScore(const MergeInfo &M, 
unsigned &Score,
   return OtherShifted > MyShifted;
 }
 
+bool WaitcntBrackets::mergeAsyncMarkers(
+    const MergeInfo MergeInfos[NUM_INST_CNTS],
+    const SmallVectorImpl<std::array<unsigned, NUM_INST_CNTS>> &OtherMarkers) {
+  bool StrictDom = false;
+
+  LLVM_DEBUG(dbgs() << "Merging async markers ...");
+  // Early exit: both empty
+  if (AsyncMarkers.empty() && OtherMarkers.empty()) {
+    LLVM_DEBUG(dbgs() << " nothing to merge\n");
+    return false;
+  }
+  LLVM_DEBUG(dbgs() << '\n');
+
+  // Determine maximum length needed after merging
+  size_t MaxSize = std::max(AsyncMarkers.size(), OtherMarkers.size());
+
+  // Pad with zero-filled markers if our list is shorter.
+  // Zero represents "no pending async operations at this checkpoint"
+  // and acts as the identity element for max() during merging
+  std::array<unsigned, NUM_INST_CNTS> ZeroMarker{};
+  AsyncMarkers.resize(MaxSize, ZeroMarker);
----------------
nhaehnle wrote:

Shouldn't the zeroes be inserted at the beginning of the vector?

https://github.com/llvm/llvm-project/pull/173259
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to