diff options
| author | Mark Heffernan <meheff@google.com> | 2015-07-13 18:26:27 +0000 |
|---|---|---|
| committer | Mark Heffernan <meheff@google.com> | 2015-07-13 18:26:27 +0000 |
| commit | d7ebc24112a73b90b0cff0c7beea3dcc9cd81bdd (patch) | |
| tree | 458397018da2ee0cd19899e379dfa9e549843301 /llvm/lib | |
| parent | 857237ee70b8689d6c5e5976ae1873fc425cb3ad (diff) | |
| download | bcm5719-llvm-d7ebc24112a73b90b0cff0c7beea3dcc9cd81bdd.tar.gz bcm5719-llvm-d7ebc24112a73b90b0cff0c7beea3dcc9cd81bdd.zip | |
Enable runtime unrolling with unroll pragma metadata
Enable runtime unrolling for loops with unroll count metadata ("#pragma unroll N")
and a runtime trip count. Also, do not unroll loops with unroll full metadata if the
loop has a runtime loop count. Previously, such loops would be unrolled with a
very large threshold (pragma-unroll-threshold) if runtime unrolled happened to be
enabled resulting in a very large (and likely unwise) unroll factor.
llvm-svn: 242047
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index 9e7558d9c45..d78db6c369b 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -840,8 +840,10 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) { // Reduce count based on the type of unrolling and the threshold values. unsigned OriginalCount = Count; - bool AllowRuntime = UserRuntime ? CurrentRuntime : UP.Runtime; - if (HasRuntimeUnrollDisablePragma(L)) { + bool AllowRuntime = + (PragmaCount > 0) || (UserRuntime ? CurrentRuntime : UP.Runtime); + // Don't unroll a runtime trip count loop with unroll full pragma. + if (HasRuntimeUnrollDisablePragma(L) || PragmaFullUnroll) { AllowRuntime = false; } if (Unrolling == Partial) { |

