https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98736
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:6c6a1173cccfd9c466e43bafa7ef7940b93d1495 commit r10-9758-g6c6a1173cccfd9c466e43bafa7ef7940b93d1495 Author: Bin Cheng <bin.ch...@linux.alibaba.com> Date: Wed Apr 7 10:24:32 2021 +0800 tree-optimization/98736 - use programing order preserved RPO in ldist Tree loop distribution uses RPO to build reduced dependence graph, it's important that RPO preserves the original programing order. Though it usually does so, when distributing loop nest, exit BB can be placed before some loop BBs while after loop header. This patch fixes the issue by calling rev_post_order_and_mark_dfs_back_seme. gcc/ChangeLog: PR tree-optimization/98736 * tree-loop-distribution.c * (loop_distribution::bb_top_order_init): Compute RPO with programing order preserved by calling function rev_post_order_and_mark_dfs_back_seme. gcc/testsuite/ChangeLog: PR tree-optimization/98736 * gcc.c-torture/execute/pr98736.c: New test. (cherry picked from commit e0bdccac582c01c928a05f26edcd8f5ac24669eb)