Use C-style loop lowering instead of C++-style.
The C and C++ front ends used to use the same strategy of lowering
loops to gotos with the end test canonicalized to the bottom of the
loop. In 2014 the C++ front end was changed to emit LOOP_EXPRs
instead (commit
1a45860e7757ee054f6bf98bee4ebe5c661dfb90).
As part of the unification of the C and C++ loop handling, it's
desirable to use the same lowering strategy for both languages.
Applying the C++ strategy to C caused a number of regressions in C
optimization tests, related to flipping the sense of the COND_EXPR for
the exit test and changes in block ordering in the output code. Many
of these regressions just require updating regexps in the test cases
but a few appear to be genuine optimization failures. Since it
appears the optimizers handle the C code better than C++ code, let's
go back to using the C strategy for both languages. The rationale for
the 2014 C++ patch (support for constexpr evaluation) has been solved
in other ways meanwhile.
2020-08-12 Sandra Loosemore <sandra@codesourcery.com>
gcc/c-family/
* c-gimplify.c (genericize_c_loop): Rewrite to match
c_finish_loop in c-typeck.c.