From patchwork Mon Mar 26 13:15:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 7468 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C5C4623E01 for ; Mon, 26 Mar 2012 13:15:44 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 87139A18286 for ; Mon, 26 Mar 2012 13:15:44 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so10883194iag.11 for ; Mon, 26 Mar 2012 06:15:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:message-id :subject:to:date:from:x-mailer:mime-version:content-type :content-transfer-encoding:x-cbid:x-gm-message-state; bh=RHg+2086GX9nmO/kuqlzqFljZiQtTeIXDrFkmNmrHK0=; b=ReGggpp1iwFbY6ve4tI1cdfT4OTUJxvGdDMZwe2ZkO9ZEuQif3e0NsWfB322EmPIc/ SFyXM9SyoKWC9tCNBJlZQ8D7KIhdzV94iZ5eXIxNGHxtKcJcdEPWymzmsHXtLp8TYtSA /lol7hjpJ3qxpdrOtSW7X3/TKKe2+z9Vs0mLApLUsDp5/uDxrg/b6l5l8Jgi9/JEsUjX CDJEqMwhvOcq0dehNU5myfgBgohVGgBRejuB6oofz3xfe9mipLfv8rKt5i5218kDSC+b 5dO86cChNl8mEV4sXZCpPXWig572HQk7X7AQ+yoGsx8lZltiUOnCvYAchJlMjXpqdaIg 6LCA== Received: by 10.43.134.199 with SMTP id id7mr12620921icc.21.1332767744326; Mon, 26 Mar 2012 06:15:44 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.5.205 with SMTP id 13csp19111ibw; Mon, 26 Mar 2012 06:15:43 -0700 (PDT) Received: by 10.216.131.206 with SMTP id m56mr11863044wei.92.1332767742154; Mon, 26 Mar 2012 06:15:42 -0700 (PDT) Received: from e06smtp16.uk.ibm.com (e06smtp16.uk.ibm.com. [195.75.94.112]) by mx.google.com with ESMTPS id v2si17119969weq.39.2012.03.26.06.15.41 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Mar 2012 06:15:42 -0700 (PDT) Received-SPF: pass (google.com: domain of uweigand@de.ibm.com designates 195.75.94.112 as permitted sender) client-ip=195.75.94.112; Authentication-Results: mx.google.com; spf=pass (google.com: domain of uweigand@de.ibm.com designates 195.75.94.112 as permitted sender) smtp.mail=uweigand@de.ibm.com Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 26 Mar 2012 14:15:41 +0100 Received: from d06nrmr1507.portsmouth.uk.ibm.com (9.149.38.233) by e06smtp16.uk.ibm.com (192.168.101.146) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 26 Mar 2012 14:15:24 +0100 Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q2QDFM0B2453692 for ; Mon, 26 Mar 2012 14:15:24 +0100 Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q2QDFLWj020952 for ; Mon, 26 Mar 2012 07:15:21 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id q2QDFKKk020894 for ; Mon, 26 Mar 2012 07:15:20 -0600 Message-Id: <201203261315.q2QDFKKk020894@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 26 Mar 2012 15:15:20 +0200 Subject: Fix PR tree-optimization/52686 (SLP crashes) (Re: Vectorizer patches for 4.8) To: patches@linaro.org Date: Mon, 26 Mar 2012 15:15:20 +0200 (CEST) From: "Ulrich Weigand" X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 x-cbid: 12032613-3548-0000-0000-000001722938 X-Gm-Message-State: ALoCoQnX4kOxo9qEwpY9ZGAhc/rvj+Mkvnby9pc80b4/UNhkAJkJwpBoplii5xAfbFuMWlAvysNG http://gcc.gnu.org/ml/gcc-patches/2012-03/msg01648.html Hello, one of Ira's vectorizer patches I recently committed seems to have exposed a pre-existing bug in handling WIDEN_LSHIFT_EXPR, which now causes ICEs in SLP due to out-of-bounds memory accesses. The underlying cause is that vect_get_smallest_scalar_type does not handle WIDEN_LSHIFT_EXPR as it does the other widening operations. This causes the SLP pass to operate on the wrong type and thus get confused about the number of vector instructions it need to allocate space for. The following patch fixes all those ICEs for me. Manual checking shows that widening shifts are now recognized correctly by SLP. Tested with no regression on armv7l-linux-gnueabi and i686-linux-gnu. OK for mainline? Bye, Ulrich ChangeLog: gcc/ PR tree-optimization/52686 * tree-vect-data-refs.c (vect_get_smallest_scalar_type): Handle WIDEN_LSHIFT_EXPR. gcc/testsuite/ PR tree-optimization/52686 * gcc.target/arm/pr52686.c: New test. Index: gcc/testsuite/gcc.target/arm/pr52686.c =================================================================== --- gcc/testsuite/gcc.target/arm/pr52686.c (revision 0) +++ gcc/testsuite/gcc.target/arm/pr52686.c (revision 0) @@ -0,0 +1,19 @@ +/* PR target/52375 */ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_neon_ok } */ +/* { dg-options "-march=armv7-a -mfloat-abi=softfp -mfpu=neon -O -ftree-vectorize" } */ + +unsigned int output[4]; + +void test (unsigned short *p) +{ + unsigned int x = *p; + if (x) + { + output[0] = x << 1; + output[1] = x << 1; + output[2] = x << 1; + output[3] = x << 1; + } +} + Index: gcc/tree-vect-data-refs.c =================================================================== --- gcc/tree-vect-data-refs.c (revision 185467) +++ gcc/tree-vect-data-refs.c (working copy) @@ -111,6 +111,7 @@ if (is_gimple_assign (stmt) && (gimple_assign_cast_p (stmt) || gimple_assign_rhs_code (stmt) == WIDEN_MULT_EXPR + || gimple_assign_rhs_code (stmt) == WIDEN_LSHIFT_EXPR || gimple_assign_rhs_code (stmt) == FLOAT_EXPR)) { tree rhs_type = TREE_TYPE (gimple_assign_rhs1 (stmt));