[PATCH] D19553: Unroll pass restructure.
Michael Zolotukhin via llvm-commits
llvm-commits at lists.llvm.org
Fri May 13 15:14:36 PDT 2016
mzolotukhin added inline comments.
================
Comment at: lib/Transforms/Scalar/LoopUnrollPass.cpp:537-544
@@ -549,1 +536,10 @@
+ bool UserUnrollCount = UnrollCount.getNumOccurrences() > 0;
+ if (UserUnrollCount) {
+ UP.Count = UnrollCount;
+ UP.AllowExpensiveTripCount = true;
+ UP.Force = true;
+ if (UP.AllowRemainder &&
+ (LoopSize - 2) * UP.Count + 2 < UP.Threshold)
+ return true;
+ }
----------------
I find it a bit confusing that we change values in `UP` even if we don't exit the function. Can we rewrite it to something like:
```
If (condition1) {
UP = ...;
return true; // We only change UP when we are going to return
}
if (condition2) {
UP = ...;
return true;
}
```
as opposed to
```
if (condition1) {
UP = ...
if (condition)
return true;
// Here we changed UP, but didn't return
}
```
Repository:
rL LLVM
http://reviews.llvm.org/D19553
More information about the llvm-commits
mailing list