summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAndreas Bolka <a@bolka.at>2009-08-13 03:00:57 +0000
committerAndreas Bolka <a@bolka.at>2009-08-13 03:00:57 +0000
commitaef432505b8086980cca9edee3e2078c92dd5fc1 (patch)
tree6461f03c3ae7172336c1702e1c24b4f5b805b907 /llvm/lib
parent438ba80afa31d62bbb27a3309e9013ea9c949f05 (diff)
downloadbcm5719-llvm-aef432505b8086980cca9edee3e2078c92dd5fc1.tar.gz
bcm5719-llvm-aef432505b8086980cca9edee3e2078c92dd5fc1.zip
Simplify and reduce indentation using early exits.
No intended functionality change. llvm-svn: 78888
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnroll.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnroll.cpp b/llvm/lib/Transforms/Scalar/LoopUnroll.cpp
index 161874f88f7..3f70c33bd45 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnroll.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnroll.cpp
@@ -133,11 +133,9 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
// 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 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
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");
}
}
OpenPOWER on IntegriCloud