------- Additional Comments From rakdver at gcc dot gnu dot org 2005-04-04 14:03 ------- This is scev analysis problem. On this testcase, it produces exponentially large expressions (of form a_5 + b_6 + b_6 - a_5 + b_6 + b_6 - a_5 + b_6 - a_5 ...).
As for possible solutions: more clever folding that would transform this to c1 * a_5 + c2 * b_6 would help in this particular case, but the possibility that an exponentially large expression that will not be possible to fold will be produced by scev would still exist. Scev probably should keep track of how large expressions it produces, and just give up if it grows beyond some limit. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20742