This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/60418] [4.9 Regression] 435.gromacs in SPEC CPU 2006 is miscompiled


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60418

--- Comment #26 from H.J. Lu <hjl.tools at gmail dot com> ---
This patch avoids removing preheader when optimizing since
preheader will be added back later even if it is removed:

diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 926d300..af5b24b 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -328,7 +328,10 @@ tree_forwarder_block_p (basic_block bb, bool phi_wanted)
                  (LOOPS_MAY_HAVE_MULTIPLE_LATCHES));
       }
     else if (bb->loop_father == loop_outer (dest->loop_father))
-      return !loops_state_satisfies_p (LOOPS_HAVE_PREHEADERS);
+      /* Preserve preheader when optimizing since it will be added
+         back later.  */
+      return !(optimize
+          || loops_state_satisfies_p (LOOPS_HAVE_PREHEADERS));
     /* Always preserve other edges into loop headers that are
        not simple latches or preheaders.  */
     return false;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]