[SCEV] Add a threshold to restrict number of mul operands to be inlined into SCEV
This is to solve the same slow-compile issue in SCEV that D3127 was trying to solve. But that patch is no longer active.
Without a threshold for mul ops inlining, getMulExpr could have exponential time complexity in the worst case. The case in PR18606 is an example that causes clang to hang.
However, this patch does not completely solve the slow-compile issue in SCEV. The reason is, not completely flattening the SCEV DAG will make SCEVRewriteVisitor another bottleneck, which visits the same SCEV multiple times and could take exponential time to finish. I will fix this in another patch.
I'd have phrased the limit as a cap on the size of Ops (either Ops.size() directly, or a cap on the number of new elements added to Ops in this loop). Any specific reason why you chose this approach over that?