https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82726
--- Comment #6 from amker at gcc dot gnu.org --- Author: amker Date: Tue Dec 19 15:25:56 2017 New Revision: 255828 URL: https://gcc.gnu.org/viewcvs?rev=255828&root=gcc&view=rev Log: Backport from mainline 2017-11-15 Bin Cheng <bin.ch...@arm.com> PR tree-optimization/82726 PR tree-optimization/70754 * tree-predcom.c (order_drefs_by_pos): New function. (combine_chains): Move code setting has_max_use_after to... (try_combine_chains): ...here. New parameter. Sort combined chains according to position information. (tree_predictive_commoning_loop): Update call to above function. (update_pos_for_combined_chains, pcom_stmt_dominates_stmt_p): New. 2017-11-15 Bin Cheng <bin.ch...@arm.com> PR tree-optimization/82726 Revert 2017-01-23 Bin Cheng <bin.ch...@arm.com> PR tree-optimization/70754 * tree-predcom.c (stmt_combining_refs): New parameter INSERT_BEFORE. (reassociate_to_the_same_stmt): New parameter INSERT_BEFORE. Insert combined stmt before it if not NULL. (combine_chains): Process refs reversely and compute dominance point for root ref. Revert 2017-02-23 Bin Cheng <bin.ch...@arm.com> PR tree-optimization/79663 * tree-predcom.c (combine_chains): Process refs in reverse order only for ZERO length chains, and add explaining comment. gcc/testsuite Backport from mainline 2017-11-15 Bin Cheng <bin.ch...@arm.com> PR tree-optimization/82726 * gcc.dg/tree-ssa/pr82726.c: New test. Added: branches/gcc-7-branch/gcc/testsuite/gcc.dg/tree-ssa/pr82726.c Modified: branches/gcc-7-branch/gcc/ChangeLog branches/gcc-7-branch/gcc/testsuite/ChangeLog branches/gcc-7-branch/gcc/tree-predcom.c