[llvm] [LoopUnroll] Consider convergence control tokens when unrolling (PR #91715)

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 01:54:38 PDT 2024


================
@@ -163,20 +175,34 @@ void CodeMetrics::analyzeBasicBlock(
     if (isa<ExtractElementInst>(I) || I.getType()->isVectorTy())
       ++NumVectorInsts;
 
-    if (I.getType()->isTokenTy() && I.isUsedOutsideOfBlock(BB))
+    if (L && isa<ConvergenceControlInst>(I)) {
+      if (isUsedOutsideOfLoop(I, *L)) {
+        LLVM_DEBUG(dbgs() << I
+                          << "\n  Cannot duplicate a convergence control token "
+                             "used outside the loop.\n");
+        notDuplicatable = true;
----------------
ssahasra wrote:

Fixed. `canUnroll()` now separately considers any discovered convergence instead of mixing it with `notDuplicatable`.

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


More information about the llvm-commits mailing list