The current full unroll cost model does a symbolic evaluation of the loop up to a fixed limit. That symbolic evaluation currently simplifies to constants, but I'm planning to extend that to using SimplifyInstruction infrastructure in the near future. This patch uses the simplified operands (at this point constants), and asks SCEV to prove a condition. SCEV can use a mix of induction reasoning, and (most relevantly) dominating branch conditions.
With the constant domain, this is a bit hard to exercise. I mostly split it into it's own patch for ease of review - it becomes more useful once we have symbolic evaluation on the value domain. (Forthcoming.)
clang-tidy: warning: invalid case style for variable 'evaluateCondition' [readability-identifier-naming]
not useful