[llvm] [AMDGPU] Change control flow intrinsic lowering making the wave to re… (PR #86805)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 12:49:12 PDT 2024


================
@@ -305,28 +305,20 @@ bool SIAnnotateControlFlow::handleLoop(BranchInst *Term) {
 }
 
 /// Close the last opened control flow
-bool SIAnnotateControlFlow::closeControlFlow(BasicBlock *BB) {
-
-  assert(Stack.back().first == BB);
-
-  Value *Exec = popSaved();
-  Instruction *ExecDef = dyn_cast<Instruction>(Exec);
-  BasicBlock *DefBB = ExecDef->getParent();
-  for (auto Pred : predecessors(BB)) {
-    llvm::Loop *L = LI->getLoopFor(Pred);
-    bool IsLoopLatch = false;
-    if (L) {
-      SmallVector<BasicBlock *, 4> LL;
-      L->getLoopLatches(LL);
-      IsLoopLatch = std::find_if(LL.begin(), LL.end(), [Pred](BasicBlock *B) {
-                      return B == Pred;
-                    }) != LL.end();
-    }
-    if (Pred != DefBB && DT->dominates(DefBB, Pred) && !IsLoopLatch) {
-      BasicBlock::iterator InsPt(Pred->getTerminator());
-      IRBuilder<>(Pred, InsPt).CreateCall(EndCf, {Exec});
-    }
-  }
+bool SIAnnotateControlFlow::insertWaveReconverge(BasicBlock *BB) {
+      assert(succ_empty(BB) || succ_size(BB) == 1);
----------------
arsenm wrote:

Remove the empty assert and sink the == 2 case down below the if (empty) 

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


More information about the llvm-commits mailing list