From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13255 invoked by alias); 20 Dec 2010 09:00:38 -0000 Received: (qmail 13224 invoked by uid 22791); 20 Dec 2010 09:00:34 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 20 Dec 2010 09:00:28 +0000 From: "irar at il dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/47001] segmentation fault in vect_mark_slp_stmts X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: irar at il dot ibm.com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: irar at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Last reconfirmed CC AssignedTo Ever Confirmed Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 20 Dec 2010 09:00:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-12/txt/msg02337.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47001 Ira Rosen changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2010.12.20 09:00:13 CC| |irar at il dot ibm.com AssignedTo|unassigned at gcc dot |irar at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1 --- Comment #1 from Ira Rosen 2010-12-20 09:00:13 UTC --- The vectorizer tries to do SLP for reduction here, but there is only one scalar load for both reductions, which is not supported, but also is not checked. I am testing a patch that adds such check. Index: tree-vect-slp.c =================================================================== --- tree-vect-slp.c (revision 167365) +++ tree-vect-slp.c (working copy) @@ -1002,7 +1002,35 @@ vect_supported_load_permutation_p (slp_i if (!bad_permutation) { - /* This permutaion is valid for reduction. Since the order of the + /* Check that all the loads are different. */ + load_index = sbitmap_alloc (group_size); + sbitmap_zero (load_index); + for (k = 0; k < group_size; k++) + { + first_group_load_index = VEC_index (int, load_permutation, k); + if (TEST_BIT (load_index, first_group_load_index)) + { + bad_permutation = true; + break; + } + + SET_BIT (load_index, first_group_load_index); + } + + if (!bad_permutation) + for (k = 0; k < group_size; k++) + if (!TEST_BIT (load_index, k)) + { + bad_permutation = true; + break; + } + + sbitmap_free (load_index); + } + + if (!bad_permutation) + { + /* This permutation is valid for reduction. Since the order of the statements in the nodes is not important unless they are memory accesses, we can rearrange the statements in all the nodes according to the order of the loads. */ Ira