evstupac added a comment. Hi Michael, The new function is more about a decision if we need unroll or not. lib/Transforms/Scalar/LoopUnrollPass.cpp looks like a good place for it. Thanks, Evgeny Repository: rL LLVM https://reviews.llvm.org/D21720