diff options
author | Yaxun Liu <Yaxun.Liu@amd.com> | 2018-03-02 16:22:32 +0000 |
---|---|---|
committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2018-03-02 16:22:32 +0000 |
commit | 3c42f1c3c90c5c20f3539048f1ed3f685cc914c6 (patch) | |
tree | 0d8f309bd855bb5a5075af127ab1b97cc3c3f4d0 /llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | |
parent | 505614bb4f695cb2d028726c8f37951f4ed831cf (diff) | |
download | bcm5719-llvm-3c42f1c3c90c5c20f3539048f1ed3f685cc914c6.tar.gz bcm5719-llvm-3c42f1c3c90c5c20f3539048f1ed3f685cc914c6.zip |
LoopUnroll: respect pragma unroll when AllowRemainder is disabled
Currently when AllowRemainder is disabled, pragma unroll count is not
respected even though there is no remainder. This bug causes a loop
fully unrolled in many cases even though the user specifies a unroll
count. Especially it affects OpenCL/CUDA since in many cases a loop
contains convergent instructions and currently AllowRemainder is
disabled for such loops.
Differential Revision: https://reviews.llvm.org/D43826
llvm-svn: 326585
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index 15e7da5e1a7..1e3bd252f22 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -729,7 +729,7 @@ static bool computeUnrollCount( UP.Runtime = true; UP.AllowExpensiveTripCount = true; UP.Force = true; - if (UP.AllowRemainder && + if ((UP.AllowRemainder || (TripMultiple % PragmaCount == 0)) && getUnrolledLoopSize(LoopSize, UP) < PragmaUnrollThreshold) return true; } |