[llvm] [LoopUnroll] Bound automatic full-unroll cloning work (PR #211683)

Justin Fargnoli via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 12:57:55 PDT 2026


================
@@ -918,6 +926,19 @@ static std::optional<unsigned> shouldFullUnroll(
   // When computing the unrolled size, note that BEInsns are not replicated
   // like the rest of the loop body.
   uint64_t UnrolledSize = UCE.getUnrolledLoopSize(UP, FullUnrollTripCount);
+  uint64_t LoopInstructionCount = 0;
+  for (const BasicBlock *BB : L->blocks())
+    LoopInstructionCount += BB->size();
+  uint64_t AdditionalCopies = FullUnrollTripCount - 1;
+  if (!ExplicitUnroll && UP.Threshold != NoThreshold && AdditionalCopies &&
----------------
justinfargnoli wrote:

Doesn't `shouldPragmaUnroll` already cover the `ExplicitUnroll` case? Or am I missing something? 

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


More information about the llvm-commits mailing list