Users of SCEV reasonably assume that multiplication of two constant
SCEVs will in turn be constant.
However, that is not always the case:
First, we can get here with reached depth limit, and will create
MultExpr SCEV C1 * C2 and cache it.
Then, we can get here with the same operands, but with small depth
level. But this time we will find existing MultExpr SCEV and return
it, instead of expected constant SCEV.
This patch changes getMultExpr to first try constant folding of SCEV
and then apply depth limit, just like getAddExpr does.
It might result in further get{Add|Mult}Expr calls, but they would
perform constant folding only and should not be too expensive.
This is too expensive. Provided that ops are sorted by type, it's enough to check the last one.