[NFC] factor out unrolling decision logic
authorAli Sedaghati <asedagha@sfu.ca>
Wed, 18 Aug 2021 18:09:04 +0000 (11:09 -0700)
committerMircea Trofin <mtrofin@google.com>
Wed, 18 Aug 2021 18:21:40 +0000 (11:21 -0700)
commit4d559837e887c278d7c27274f4f6b1b78b97c00d
tree0ef0833a70ae00b9ac60bb0eb4ff7b3b326abbac
parent811dbecaf5eafc434ba290784c787b49c293d0b8
[NFC] factor out unrolling decision logic

Decoupling the unrolling logic into three different functions. The shouldPragmaUnroll() covers the 1st and 2nd priorities of the previous code, the shouldFullUnroll() covers the 3rd, and the shouldPartialUnroll() covers the 5th. The output of each function, Optional<unsigned>, could be a value for UP.Count, which means unrolling factor has been set, or None, which means decision hasn't been made yet and should try the next priority.

Reviewed By: mtrofin, jdoerfert

Differential Revision: https://reviews.llvm.org/D106001
llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp