This fixes bug 18606.
In certain cases we may get exponentially sized SCEV's in the form of:
S0 = InitialValue
S1 = mul S0 S0
S2 = mul S1 S1
S3 = mul S2 S2
Naively visiting every expression will result in the exponential complexity. However by adding caching layer we can simplify this and achieve linear complexity.
Note that caching doesn't protect us from other forms of the exponentially sized SCEV's. In order to not run infinite compiles in those cases I will add separate threshold in the follow up change.