[llvm] [SimplifyCFG] Not folding branch in loop header with constant iterations (PR #74268)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 01:21:56 PST 2023


nikic wrote:

I checked, and for your test case, LoopUnroll recognizes the loop as an UpperBound unrolling candidate, but does not perform unrolling due to cost model.

The pragma unroll metadata currently only takes effect if there is an exact trip count, but not if there is an upper bound trip count. Making it work with an upper bound trip count as well should fix your case. See the code in shouldPragmaUnroll().

https://github.com/llvm/llvm-project/pull/74268


More information about the llvm-commits mailing list