[llvm-commits] [llvm] r78888 - /llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp
Andreas Bolka
a at bolka.at
Wed Aug 12 20:00:57 PDT 2009
Author: abolka
Date: Wed Aug 12 22:00:57 2009
New Revision: 78888
URL: http://llvm.org/viewvc/llvm-project?rev=78888&view=rev
Log:
Simplify and reduce indentation using early exits.
No intended functionality change.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp?rev=78888&r1=78887&r2=78888&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp Wed Aug 12 22:00:57 2009
@@ -133,11 +133,9 @@
// completely unroll (subject to the threshold, checked below); otherwise
// try to find greatest modulo of the trip count which is still under
// threshold value.
- if (TripCount != 0) {
- Count = TripCount;
- } else {
+ if (TripCount == 0)
return false;
- }
+ Count = TripCount;
}
// Enforce the threshold.
@@ -148,24 +146,21 @@
if (TripCount != 1 && Size > UnrollThreshold) {
DEBUG(errs() << " Too large to fully unroll with count: " << Count
<< " because size: " << Size << ">" << UnrollThreshold << "\n");
- if (UnrollAllowPartial) {
- // Reduce unroll count to be modulo of TripCount for partial unrolling
- Count = UnrollThreshold / LoopSize;
- while (Count != 0 && TripCount%Count != 0) {
- Count--;
- }
- if (Count < 2) {
- DEBUG(errs() << " could not unroll partially\n");
- return false;
- } else {
- DEBUG(errs() << " partially unrolling with count: "
- << Count << "\n");
- }
- } else {
+ if (!UnrollAllowPartial) {
DEBUG(errs() << " will not try to unroll partially because "
<< "-unroll-allow-partial not given\n");
return false;
}
+ // Reduce unroll count to be modulo of TripCount for partial unrolling
+ Count = UnrollThreshold / LoopSize;
+ while (Count != 0 && TripCount%Count != 0) {
+ Count--;
+ }
+ if (Count < 2) {
+ DEBUG(errs() << " could not unroll partially\n");
+ return false;
+ }
+ DEBUG(errs() << " partially unrolling with count: " << Count << "\n");
}
}
More information about the llvm-commits
mailing list