LoopUnroll: respect pragma unroll when AllowRemainder is disabled
authorYaxun Liu <Yaxun.Liu@amd.com>
Fri, 2 Mar 2018 16:22:32 +0000 (16:22 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Fri, 2 Mar 2018 16:22:32 +0000 (16:22 +0000)
commit3c42f1c3c90c5c20f3539048f1ed3f685cc914c6
tree0d8f309bd855bb5a5075af127ab1b97cc3c3f4d0
parent505614bb4f695cb2d028726c8f37951f4ed831cf
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
llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
llvm/test/Transforms/LoopUnroll/convergent.ll
llvm/test/Transforms/LoopUnroll/unroll-pragmas.ll