[PATCH] D19553: Unroll pass restructure.

Z. Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed May 4 15:27:04 PDT 2016


zzheng added a comment.

Can we have consolidate unrolled size computation or threshold enforcement?

Also, please elaborate on forced unrolled of runtime loops.

Thanks


================
Comment at: lib/Transforms/Scalar/LoopUnrollPass.cpp:539
@@ +538,3 @@
+    UP.Force = true;
+    if ((LoopSize - 2) * UP.Count + 2 < UP.Threshold
+        && UP.AllowRemainder)
----------------
This formula appears several times... It'll be better to have a consolidated function that computes the unrolled size or enforces the threshold.

================
Comment at: lib/Transforms/Scalar/LoopUnrollPass.cpp:564
@@ -575,1 +563,3 @@
+  bool HasPragma = PragmaCount > 0 || PragmaFullUnroll || PragmaEnableUnroll ||
+                   UnrollCount.getNumOccurrences() > 0;
 
----------------
This feels a little awkward. I would use

```
bool UserUnrollCount = UnrollCount.getNumOccurrences() > 0;
...

if (HasPragma || UserUnrollCount)
```


================
Comment at: lib/Transforms/Utils/LoopUnroll.cpp:305
@@ +304,3 @@
+    if (Force)
+      RuntimeTripCount = false;
+    else
----------------
I don't understand this part. If UnrollRuntimeLoopRemainder() returned false, remainder loop is not generated. How do we ensure correctness if we 'force' a loop that has runtime tripcount of 6 to by unrolled by 4?


Repository:
  rL LLVM

http://reviews.llvm.org/D19553





More information about the llvm-commits mailing list