llvm.org GIT mirror llvm / ec40eb4
Simplify and reduce indentation using early exits. No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78888 91177308-0d34-0410-b5e6-96231b3b80d8 Andreas Bolka 10 years ago
1 changed file(s) with 13 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
132132 // completely unroll (subject to the threshold, checked below); otherwise
133133 // try to find greatest modulo of the trip count which is still under
134134 // threshold value.
135 if (TripCount != 0) {
136 Count = TripCount;
137 } else {
135 if (TripCount == 0)
138136 return false;
139 }
137 Count = TripCount;
140138 }
141139
142140 // Enforce the threshold.
147145 if (TripCount != 1 && Size > UnrollThreshold) {
148146 DEBUG(errs() << " Too large to fully unroll with count: " << Count
149147 << " because size: " << Size << ">" << UnrollThreshold << "\n");
150 if (UnrollAllowPartial) {
151 // Reduce unroll count to be modulo of TripCount for partial unrolling
152 Count = UnrollThreshold / LoopSize;
153 while (Count != 0 && TripCount%Count != 0) {
154 Count--;
155 }
156 if (Count < 2) {
157 DEBUG(errs() << " could not unroll partially\n");
158 return false;
159 } else {
160 DEBUG(errs() << " partially unrolling with count: "
161 << Count << "\n");
162 }
163 } else {
148 if (!UnrollAllowPartial) {
164149 DEBUG(errs() << " will not try to unroll partially because "
165150 << "-unroll-allow-partial not given\n");
166151 return false;
167152 }
153 // Reduce unroll count to be modulo of TripCount for partial unrolling
154 Count = UnrollThreshold / LoopSize;
155 while (Count != 0 && TripCount%Count != 0) {
156 Count--;
157 }
158 if (Count < 2) {
159 DEBUG(errs() << " could not unroll partially\n");
160 return false;
161 }
162 DEBUG(errs() << " partially unrolling with count: " << Count << "\n");
168163 }
169164 }
170165