It was reported that mysql was failing its testsuite due to a regex routine being mis-compiled on the ppc and s390 platforms. Upon investigation it was found that the fix for PR61009 was incomplete.

The fix for 61009 changed thread_through_normal_block to return a tri-state with negative values indicating the block was not threadable, even for a joiner. That situation occurs when we do not process all the statements in the block (for example, the block is too big for threading). When we fail to process all the statements, then we will fail to properly invalidate entries in the equivalence tables which can result in incorrect transformations when threading across a loop backedge.

61009 detected the "block too big case", but missed the case when problematical PHIs are detected. This patch fixes that oversight.

Bootstrapped and regression tested on x86_64-unknown-linux-gnu. It fixes the short-circuited loop in mysql for s390 (by inspection) and the mysql testsuite passes on ppc using 4.9 with this addition to the original 61009 patch backported.

Installed on the trunk.  Will install onto 4.9 branch shortly.



commit 5de2d4cf14b882066026745fb1b1019561daac12
Author: Jeff Law <l...@redhat.com>
Date:   Thu Jun 12 10:13:16 2014 -0600

            PR tree-optimization/61009
        * tree-ssa-threadedge.c (thread_through_normal_block): Correct return
        value when we stop processing a block due to problematic PHIs.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a42b94d..d68262f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-12  Jeff Law  <l...@redhat.com>
+
+        PR tree-optimization/61009
+       * tree-ssa-threadedge.c (thread_through_normal_block): Correct return
+       value when we stop processing a block due to problematic PHIs.
+
 2014-06-12  Alan Lawrence  <alan.lawre...@arm.com>
 
        * config/aarch64/arm_neon.h (vmlaq_n_f64, vmlsq_n_f64, vrsrtsq_f64,
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index ba9e1fe..a76a7ce 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -948,9 +948,12 @@ thread_through_normal_block (edge e,
   if (*backedge_seen_p)
     simplify = dummy_simplify;
 
-  /* PHIs create temporary equivalences.  */
+  /* PHIs create temporary equivalences.
+     Note that if we found a PHI that made the block non-threadable, then
+     we need to bubble that up to our caller in the same manner we do
+     when we prematurely stop processing statements below.  */
   if (!record_temporary_equivalences_from_phis (e, stack))
-    return 0;
+    return -1;
 
   /* Now walk each statement recording any context sensitive
      temporary equivalences we can detect.  */

Reply via email to