[clang] [llvm] [LoopUnroll] Add flag to enforce loop unroll pragma regardless of expensive trip count (PR #180961)

Adel Ejjeh via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 11 12:52:51 PST 2026


================
@@ -1102,7 +1110,8 @@ bool llvm::computeUnrollCount(
   }
   if (UP.Count == 0)
     UP.Count = UP.DefaultUnrollRuntimeCount;
-
+  if (PragmaEnableUnroll && ForcePragmaUnroll)
+    UP.AllowExpensiveTripCount = true;
----------------
adelejjeh wrote:

Agreed. And this is the longer-term intent with bullet (1) in my PR description. However, we don't want to change the default behavior of the compiler without further testing of how that will affect users. this will also have significant ramifications on other backends as well. This is why this PR is intended as a short-term stopgap to unblock some AMDGPU users. And overall, an opt-in flag will not cause issues for other targets by changing the default compiler behavior.

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


More information about the cfe-commits mailing list