http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55270
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-01-28 13:33:47 UTC --- The problem here is in dfs_enumerate_from, which wrongly detects the number of BBs in a loop. get_loop_body_with_size calls dfs_enumerate_from with reverse = 1, thus we go against direction of edges. I.e., we start at the header, then go through its predecessors and if the predecessor hasn't been visited yet and is dominated by the header, we count it. But, we don't count BB which only has an exit edge--thus its successor is outside of the loop. Moving in !reverse direction doesn't seem to help. I'm not exactly sure what to do here, I'm afraid of touching dfs_enumerate_from algorithm ;).