[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Feb 9 12:16:00 PST 2006
Changes in directory llvm/lib/Transforms/Scalar:
LoopUnswitch.cpp updated: 1.7 -> 1.8
---
Log message:
Make the threshold a parameter
---
Diffs of the changes: (+7 -3)
LoopUnswitch.cpp | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.7 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.8
--- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.7 Thu Feb 9 13:14:52 2006
+++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Feb 9 14:15:48 2006
@@ -34,8 +34,9 @@
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/Local.h"
-#include "llvm/Support/Debug.h"
#include "llvm/ADT/Statistic.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/CommandLine.h"
#include <algorithm>
#include <iostream>
#include <set>
@@ -43,7 +44,10 @@
namespace {
Statistic<> NumUnswitched("loop-unswitch", "Number of loops unswitched");
-
+ cl::opt<unsigned>
+ Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"),
+ cl::init(10), cl::Hidden);
+
class LoopUnswitch : public FunctionPass {
LoopInfo *LI; // Loop information
public:
@@ -145,7 +149,7 @@
continue;
// Check to see if it would be profitable to unswitch this loop.
- if (L->getBlocks().size() > 10) {
+ if (L->getBlocks().size() > Threshold) {
// FIXME: this should estimate growth by the amount of code shared by the
// resultant unswitched loops. This should have no code growth:
// for () { if (iv) {...} }
More information about the llvm-commits
mailing list