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

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 10:13:21 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;
----------------
efriedma-quic wrote:

FunctionSpecialization is currently using CodeMetrics; does it really not care about the distinction?

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


More information about the llvm-commits mailing list