[PATCH] D154695: [Coroutines] Add an O(n) algorithm for computing the cross suspend point information.

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 26 19:22:40 PDT 2023


ChuanqiXu added inline comments.


================
Comment at: llvm/lib/Transforms/Coroutines/CoroFrame.cpp:151
+  bool collectConsumeKillInfo(size_t EntryNo,
+                              const SmallVector<int> &BlockPredecessorsNum);
 
----------------
ditto in other places.


================
Comment at: llvm/lib/Transforms/Coroutines/CoroFrame.cpp:263
+  bool FoundBackEdge = false;
+  auto BlockPredNum = BlockPredecessorsNum;
+  // BlockNo Queue with BlockPredNum[BlockNo] equal to zero.
----------------
Now we can understand it is a dynamic attribute instead of a static one. Then it is not odd that it may change.


================
Comment at: llvm/lib/Transforms/Coroutines/CoroFrame.cpp:337-350
+        for (auto I : MaybeBackEdgeSet) {
+          for (BasicBlock *PI : llvm::predecessors(Mapping.indexToBlock(I))) {
+            auto PredNo = Mapping.blockToIndex(PI);
+            auto &P = Block[PredNo];
+            // PredNo -> I exists, then check path I -> PredNo.
+            if (P.Consumes[I]) {
+              CandidateNo = I;
----------------



================
Comment at: llvm/lib/Transforms/Coroutines/CoroFrame.cpp:351-352
+        }
+        // Must find one CandidateNo, otherwise this is a bug.
+        assert(CandidateNo != size_t(-1) && "A bug reached");
+      } else
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154695



More information about the llvm-commits mailing list