As noted in PR45201,
PR10090 SCEV doesn't always avoid
recursive algorithms, and that causes issues with large expression depths and/or smaller stack sizes.
In SCEVExpander::isHighCostExpansion*() case, the refactoring to avoid recursion
is rather idiomatic. We simply need to place the root expr into a vector,
and iterate over vector elements accounting for the cost of each one,
and add new exprs at the end of the vector, thus achieving FIFO breadth-first traversal.
Can we go with queue?