[llvm] Make 'UnrollMaxUpperBound' to be overridable by target. (PR #76029)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 01:27:22 PST 2023


================
@@ -560,6 +560,13 @@ class TargetTransformInfo {
     // (set to UINT_MAX to disable). This does not apply in cases where the
     // loop is being fully unrolled.
     unsigned MaxCount;
+    /// Set the maximum upper bound of trip count. Considering a loop with 'pragma 
+    /// unroll' specified but without 'full' or 'n' field, it depends on the 
+    /// UnrollMaxUpperBound option if the loop trip is unknown. However, the 
+    /// default value is 8 for this option which might not suitable for certain
+    /// target. Allowing the MaxUpperBound to be overrided by a target gives more
+    /// flexiblity on such cases. By default, MaxUpperBound uses UnrollMaxUpperBound
----------------
nikic wrote:

```suggestion
    /// Set the maximum number of iterations to fully unroll if only an upper bound
    /// on the trip count is known.
```
I don't think the rest of the discussion really belongs in this comment. Note that this option also affects the non-pragma case, so mentioning that is misleading.

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


More information about the llvm-commits mailing list