aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorXiangZhang <xiang.zhang@iluvatar.com>2023-12-08 19:43:10 +0800
committerGitHub <noreply@github.com>2023-12-08 19:43:10 +0800
commit1d6a678591076f316bfcaa03a55beba20406dc00 (patch)
tree79af7e1fc8187b21fdb3113807d7dd41e694c87e /llvm/lib/Support/CommandLine.cpp
parent5f91335a55cd65dda8351f85b93eeaa7493e06c4 (diff)
downloadllvm-1d6a678591076f316bfcaa03a55beba20406dc00.zip
llvm-1d6a678591076f316bfcaa03a55beba20406dc00.tar.gz
llvm-1d6a678591076f316bfcaa03a55beba20406dc00.tar.bz2
[LoopUnroll] Make use of MaxTripCount for loops with "#pragma unroll" (#74703)
Fix loop unroll fail caused by branches folding. For example: SimplifyCFG foldloop branches then cause loop unroll failed for "#program unroll" loop. ``` #program unroll for (int I = 0; I < ConstNum; ++I) { // folding "I < ConstNum" and "Cond2" if (Cond2) { break; } xxx loop body; } ``` The pragma unroll metadata only takes effect if there is an exact trip count, but not if there is an upper bound trip count. This patch make it work with an upper bound trip count as well in shouldPragmaUnroll(). Loop unroll is important in stack nervous devices (e.g. GPU, and that is why a lot of GPU code mark loop with "#program unroll"). It usually much simplify the address (offset) calculations in old iterations, then we can do a lot of others optimizations, e.g, SROA, for these simplifed address (escape alloca the whole aggregates).
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
0 files changed, 0 insertions, 0 deletions