public inbox for gcc-regression@sourceware.org
help / color / mirror / Atom feed
* [TCWG CI] Regression caused by gcc: tree-optimization/106226 - move vectorizer virtual SSA update
@ 2022-07-08 21:53 ci_notify
  0 siblings, 0 replies; only message in thread
From: ci_notify @ 2022-07-08 21:53 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-regression

[TCWG CI] Regression caused by gcc: tree-optimization/106226 - move vectorizer virtual SSA update:
commit cf3a120084e94614a4917f71940325cd4b537f24
Author: Richard Biener <rguenther@suse.de>

    tree-optimization/106226 - move vectorizer virtual SSA update

Results regressed to
# reset_artifacts:
-10
# true:
0
# build_abe binutils:
1
# First few build errors in logs:
# 00:05:38 make[3]: [Makefile:1787: armv8l-unknown-linux-gnueabihf/bits/largefile-config.h] Error 1 (ignored)
# 00:08:06 /home/tcwg-buildslave/workspace/tcwg_gnu_14/abe/snapshots/gcc.git~master/libiberty/sha1.c:286:1: internal compiler error: in vect_transform_loops, at tree-vectorizer.cc:1032
# 00:08:07 make[3]: *** [Makefile:1284: sha1.o] Error 1
# 00:08:23 make[2]: *** [Makefile:12585: all-stage2-libiberty] Error 2
# 00:08:24 make[1]: *** [Makefile:25739: stage2-bubble] Error 2
# 00:08:24 make: *** [Makefile:1072: all] Error 2

from
# reset_artifacts:
-10
# true:
0
# build_abe binutils:
1
# build_abe bootstrap:
2

THIS IS THE END OF INTERESTING STUFF.  BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT.

This commit has regressed these CI configurations:
 - tcwg_gcc_bootstrap/master-arm-bootstrap

First_bad build: https://ci.linaro.org/job/tcwg_gcc_bootstrap-bisect-master-arm-bootstrap/18/artifact/artifacts/build-cf3a120084e94614a4917f71940325cd4b537f24/
Last_good build: https://ci.linaro.org/job/tcwg_gcc_bootstrap-bisect-master-arm-bootstrap/18/artifact/artifacts/build-95a234f5cbd510e6b8c8e53dd9f1003fddc84c28/
Baseline build: https://ci.linaro.org/job/tcwg_gcc_bootstrap-bisect-master-arm-bootstrap/18/artifact/artifacts/build-baseline/
Even more details: https://ci.linaro.org/job/tcwg_gcc_bootstrap-bisect-master-arm-bootstrap/18/artifact/artifacts/

Reproduce builds:
<cut>
mkdir investigate-gcc-cf3a120084e94614a4917f71940325cd4b537f24
cd investigate-gcc-cf3a120084e94614a4917f71940325cd4b537f24

# Fetch scripts
git clone https://git.linaro.org/toolchain/jenkins-scripts

# Fetch manifests and test.sh script
mkdir -p artifacts/manifests
curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_gcc_bootstrap-bisect-master-arm-bootstrap/18/artifact/artifacts/manifests/build-baseline.sh --fail
curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_gcc_bootstrap-bisect-master-arm-bootstrap/18/artifact/artifacts/manifests/build-parameters.sh --fail
curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_gcc_bootstrap-bisect-master-arm-bootstrap/18/artifact/artifacts/test.sh --fail
chmod +x artifacts/test.sh

# Reproduce the baseline build (build all pre-requisites)
./jenkins-scripts/tcwg_gnu-build.sh @@ artifacts/manifests/build-baseline.sh

# Save baseline build state (which is then restored in artifacts/test.sh)
mkdir -p ./bisect
rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /gcc/ ./ ./bisect/baseline/

cd gcc

# Reproduce first_bad build
git checkout --detach cf3a120084e94614a4917f71940325cd4b537f24
../artifacts/test.sh

# Reproduce last_good build
git checkout --detach 95a234f5cbd510e6b8c8e53dd9f1003fddc84c28
../artifacts/test.sh

cd ..
</cut>

Full commit (up to 1000 lines):
<cut>
commit cf3a120084e94614a4917f71940325cd4b537f24
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Jul 8 10:41:59 2022 +0200

    tree-optimization/106226 - move vectorizer virtual SSA update
    
    When we knowingly have broken virtual SSA form we need to update
    it before we eventually perform slpeel manual updating which will
    call delete_update_ssa.  Currently that's done on-demand but
    communicating whether it's a known unavoidable case is broken
    there.  The following makes that a synchronous operation but
    instead of actually performing the update we instead recod the
    need, clear the update SSA sub-state and force virtual renaming
    at the very end of the vectorization pass.
    
            PR tree-optimization/106226
            * tree-vect-loop-manip.cc (vect_do_peeling): Assert that
            no SSA update is needed.  Move virtual SSA update ...
            * tree-vectorizer.cc (pass_vectorize::execute): ... here,
            via forced virtual renaming when TODO_update_ssa_only_virtuals
            is queued.
            (vect_transform_loops): Return TODO_update_ssa_only_virtuals
            when virtual SSA update is required.
            (try_vectorize_loop_1): Adjust.
            * tree-vect-stmts.cc (vectorizable_simd_clone_call): Allow
            virtual renaming if the ABI forces an aggregate return
            but the original call did not have a virtual definition.
    
            * gfortran.dg/pr106226.f: New testcase.
---
 gcc/testsuite/gfortran.dg/pr106226.f | 37 ++++++++++++++++++++++++++++++++++++
 gcc/tree-vect-loop-manip.cc          | 11 +++++------
 gcc/tree-vect-stmts.cc               |  8 ++++++++
 gcc/tree-vectorizer.cc               | 29 +++++++++++++++++++++++++---
 4 files changed, 76 insertions(+), 9 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/pr106226.f b/gcc/testsuite/gfortran.dg/pr106226.f
new file mode 100644
index 00000000000..19237bc5a71
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr106226.f
@@ -0,0 +1,37 @@
+! { dg-do compile }
+! { dg-options "-O3 -std=legacy" }
+
+      SUBROUTINE EFTORD(DM,CHDINT,L4)
+      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
+      PARAMETER (MXPT=100, MXFRG=50, MXFGPT=MXPT*MXFRG)
+      DIMENSION DM(*),CHDINT(L4)
+      COMMON /FGRAD / DEF0,DEFT0,TORQ0
+     *                ,ATORQ(3,MXFRG)
+      COMMON /CSSTV / CX,CY,CZ
+     *                EFBTRM(MXFGPT),EFATRM2(MXFGPT),EFBTRM2(MXFGPT),
+     *                EFDIP(3,MXFGPT),EFQAD(6,MXFGPT),
+     *                EFOCT(10,MXFGPT),FRGNME(MXFGPT)
+      IF(NROOTS.EQ.5) CALL ROOT5
+      IF(NROOTS.EQ.6) CALL ROOT6
+      IF(NROOTS.GE.7) THEN
+         CALL ABRT
+      END IF
+      DO 403 I = 1,IJ
+      CHDINT(ICC)=CHDINT(ICC)-DUM*DUMY
+      ICC=ICC+1
+ 403  CONTINUE
+      CHDINT(ICC)=CHDINT(ICC)-DUM*DUMY
+      DO 550 J=MINJ,MAX
+      LJ=LOCJ+J
+      IF (LI-LJ) 920,940,940
+  920 ID = LJ
+      GO TO 960
+  940 ID = LI
+  960 NN = (ID*(ID-1))/2+JD
+      DUM = DM(NN)
+      ATORQ(1,INF)=ATORQ(1,INF)-DUM*(CHDINT(ICC+1)*EFDIP(3,IC)
+     $           -CHDINT(ICC+2)*EFDIP(2,IC))
+      ICC=ICC+1
+      ICC=ICC+1
+  550 CONTINUE
+      END
diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index d7410d7b4bd..2c2b4f7bd53 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -2696,12 +2696,11 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
   class loop *first_loop = loop;
   bool irred_flag = loop_preheader_edge (loop)->flags & EDGE_IRREDUCIBLE_LOOP;
 
-  /* We should not have to update virtual SSA form here but some
-     transforms involve creating new virtual definitions which makes
-     updating difficult.  */
-  gcc_assert (!need_ssa_update_p (cfun)
-	      || loop_vinfo->any_known_not_updated_vssa);
-  update_ssa (TODO_update_ssa_only_virtuals);
+  /* SSA form needs to be up-to-date since we are going to manually
+     update SSA form in slpeel_tree_duplicate_loop_to_edge_cfg and delete all
+     update SSA state after that, so we have to make sure to not lose any
+     pending update needs.  */
+  gcc_assert (!need_ssa_update_p (cfun));
 
   create_lcssa_for_virtual_phi (loop);
 
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 3db6620dd42..01d982eea98 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -4247,6 +4247,14 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
 
   if (!vec_stmt) /* transformation not required.  */
     {
+      /* When the original call is pure or const but the SIMD ABI dictates
+	 an aggregate return we will have to use a virtual definition and
+	 in a loop eventually even need to add a virtual PHI.  That's
+	 not straight-forward so allow to fix this up via renaming.  */
+      if (gimple_call_lhs (stmt)
+	  && !gimple_vdef (stmt)
+	  && TREE_CODE (TREE_TYPE (TREE_TYPE (bestn->decl))) == ARRAY_TYPE)
+	vinfo->any_known_not_updated_vssa = true;
       STMT_VINFO_SIMD_CLONE_INFO (stmt_info).safe_push (bestn->decl);
       for (i = 0; i < nargs; i++)
 	if ((bestn->simdclone->args[i].arg_type
diff --git a/gcc/tree-vectorizer.cc b/gcc/tree-vectorizer.cc
index 53dc4520963..6ec49511d74 100644
--- a/gcc/tree-vectorizer.cc
+++ b/gcc/tree-vectorizer.cc
@@ -82,6 +82,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "opt-problem.h"
 #include "internal-fn.h"
 #include "tree-ssa-sccvn.h"
+#include "tree-into-ssa.h"
 
 /* Loop or bb location, with hotness information.  */
 dump_user_location_t vect_location;
@@ -982,7 +983,7 @@ set_uid_loop_bbs (loop_vec_info loop_vinfo, gimple *loop_vectorized_call,
 
 /* Generate vectorized code for LOOP and its epilogues.  */
 
-static void
+static unsigned
 vect_transform_loops (hash_table<simduid_to_vf> *&simduid_to_vf_htab,
 		      loop_p loop, gimple *loop_vectorized_call,
 		      function *fun)
@@ -1020,9 +1021,25 @@ vect_transform_loops (hash_table<simduid_to_vf> *&simduid_to_vf_htab,
 	  = simduid_to_vf_data;
     }
 
+  /* We should not have to update virtual SSA form here but some
+     transforms involve creating new virtual definitions which makes
+     updating difficult.
+     We delay the actual update to the end of the pass but avoid
+     confusing ourselves by forcing need_ssa_update_p () to false.  */
+  unsigned todo = 0;
+  if (need_ssa_update_p (cfun))
+    {
+      gcc_assert (loop_vinfo->any_known_not_updated_vssa);
+      fun->gimple_df->ssa_renaming_needed = false;
+      todo |= TODO_update_ssa_only_virtuals;
+    }
+  gcc_assert (!need_ssa_update_p (cfun));
+
   /* Epilogue of vectorized loop must be vectorized too.  */
   if (new_loop)
-    vect_transform_loops (simduid_to_vf_htab, new_loop, NULL, fun);
+    todo |= vect_transform_loops (simduid_to_vf_htab, new_loop, NULL, fun);
+
+  return todo;
 }
 
 /* Try to vectorize LOOP.  */
@@ -1133,7 +1150,8 @@ try_vectorize_loop_1 (hash_table<simduid_to_vf> *&simduid_to_vf_htab,
 
   (*num_vectorized_loops)++;
   /* Transform LOOP and its epilogues.  */
-  vect_transform_loops (simduid_to_vf_htab, loop, loop_vectorized_call, fun);
+  ret |= vect_transform_loops (simduid_to_vf_htab, loop,
+			       loop_vectorized_call, fun);
 
   if (loop_vectorized_call)
     {
@@ -1332,6 +1350,11 @@ pass_vectorize::execute (function *fun)
 
   if (num_vectorized_loops > 0)
     {
+      /* We are collecting some corner cases where we need to update
+	 virtual SSA form via the TODO but delete the queued update-SSA
+	 state.  Force renaming if we think that might be necessary.  */
+      if (ret & TODO_update_ssa_only_virtuals)
+	mark_virtual_operands_for_renaming (cfun);
       /* If we vectorized any loop only virtual SSA form needs to be updated.
 	 ???  Also while we try hard to update loop-closed SSA form we fail
 	 to properly do this in some corner-cases (see PR56286).  */
</cut>
>From hjl@sc.intel.com  Fri Jul  8 22:48:54 2022
Return-Path: <hjl@sc.intel.com>
X-Original-To: gcc-regression@gcc.gnu.org
Delivered-To: gcc-regression@gcc.gnu.org
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by sourceware.org (Postfix) with ESMTPS id CDFC3385840C
 for <gcc-regression@gcc.gnu.org>; Fri,  8 Jul 2022 22:48:52 +0000 (GMT)
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CDFC3385840C
X-IronPort-AV: E=McAfee;i="6400,9594,10402"; a="309967744"
X-IronPort-AV: E=Sophos;i="5.92,256,1650956400"; d="scan'208";a="309967744"
Received: from orsmga006.jf.intel.com ([10.7.209.51])
 by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 08 Jul 2022 15:48:51 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.92,256,1650956400"; d="scan'208";a="569106416"
Received: from scymds02.sc.intel.com ([10.82.73.244])
 by orsmga006.jf.intel.com with ESMTP; 08 Jul 2022 15:48:50 -0700
Received: from gnu-snb-1.sc.intel.com (gnu-snb-1.sc.intel.com [172.25.33.219])
 by scymds02.sc.intel.com with ESMTP id 268Mmoxr014415;
 Fri, 8 Jul 2022 15:48:50 -0700
Received: by gnu-snb-1.sc.intel.com (Postfix, from userid 1000)
 id D3B6A1817F8; Fri,  8 Jul 2022 15:48:50 -0700 (PDT)
Date: Fri, 08 Jul 2022 15:48:50 -0700
To: skpgkp2@gmail.com, hjl.tools@gmail.com, gcc-regression@gcc.gnu.org
Subject: Regressions on master at commit r13-1579 vs commit r13-1576 on
 Linux/i686
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20220708224850.D3B6A1817F8@gnu-snb-1.sc.intel.com>
From: "H.J. Lu" <hjl@sc.intel.com>
X-Spam-Status: No, score=-3459.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
 KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,
 SPF_HELO_NONE, SPF_NONE, TXREP,
 T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
 server2.sourceware.org
X-BeenThere: gcc-regression@gcc.gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Gcc-regression mailing list <gcc-regression.gcc.gnu.org>
List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-regression>,
 <mailto:gcc-regression-request@gcc.gnu.org?subject=unsubscribe>
List-Archive: <https://gcc.gnu.org/pipermail/gcc-regression/>
List-Post: <mailto:gcc-regression@gcc.gnu.org>
List-Help: <mailto:gcc-regression-request@gcc.gnu.org?subject=help>
List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-regression>,
 <mailto:gcc-regression-request@gcc.gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 08 Jul 2022 22:48:54 -0000

New failures:
FAIL: libgomp.fortran/target-nowait-array-section.f90   -O  execution test

New passes:
FAIL: gcc.dg/tree-ssa/alias-access-path-13.c scan-tree-dump-times fre1 "return 123" 1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-08 21:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-08 21:53 [TCWG CI] Regression caused by gcc: tree-optimization/106226 - move vectorizer virtual SSA update ci_notify

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).