From patchwork Tue Apr 10 13:53:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 7730 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 5546823E12 for ; Tue, 10 Apr 2012 13:53:20 +0000 (UTC) Received: from mail-gy0-f180.google.com (mail-gy0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 1FF57A189EE for ; Tue, 10 Apr 2012 13:53:20 +0000 (UTC) Received: by ghbz12 with SMTP id z12so2801659ghb.11 for ; Tue, 10 Apr 2012 06:53:19 -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=b3G70GEo0wX4qenlb2SZI5ljzckOZdWm2GuWLWieQr0=; b=SRhy/PuoEIOTIRiLC+pjuPO50xj1J2bTsu5Tp7vUo525nEw5bt2smbG/VFn8nbVKVU nI3UmsiWmTnJCQybHabSYVejk4PS0fP4CoktE9RUqUDiHQRlxAaoLqDZvrmY5ZIZ8dPS SAqy9UlcGUlGTdMkYwU7O/OenXuaJOBQpR44P0fcj+1EruAVTjX9yCeSBCyBZAZtFVGW kxIZGnRoIoamRXbhWu5+wspO7yoiFvZoahUtUB11Y1c9SrHdgxt5kcJi08Ipn7tO+yvK +MtvExWDatK6NUGZPfzdIh+4SDT/hwPX84+Ke5gF7kdpFIP3PWBdsez5zk50/7bBOrHS CleQ== Received: by 10.50.156.229 with SMTP id wh5mr2486320igb.28.1334065999400; Tue, 10 Apr 2012 06:53:19 -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.164.217 with SMTP id f25csp22817iby; Tue, 10 Apr 2012 06:53:18 -0700 (PDT) Received: by 10.216.136.131 with SMTP id w3mr6522161wei.15.1334065997810; Tue, 10 Apr 2012 06:53:17 -0700 (PDT) Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com. [195.75.94.106]) by mx.google.com with ESMTPS id y33si18342630weq.67.2012.04.10.06.53.17 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 Apr 2012 06:53:17 -0700 (PDT) Received-SPF: pass (google.com: domain of uweigand@de.ibm.com designates 195.75.94.106 as permitted sender) client-ip=195.75.94.106; Authentication-Results: mx.google.com; spf=pass (google.com: domain of uweigand@de.ibm.com designates 195.75.94.106 as permitted sender) smtp.mail=uweigand@de.ibm.com Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Apr 2012 14:53:16 +0100 Received: from d06nrmr1307.portsmouth.uk.ibm.com (9.149.38.129) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 10 Apr 2012 14:53:08 +0100 Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q3ADr6GM2375844 for ; Tue, 10 Apr 2012 14:53:06 +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 q3ADr5Qx013608 for ; Tue, 10 Apr 2012 07:53:05 -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 q3ADr4G8013445 for ; Tue, 10 Apr 2012 07:53:04 -0600 Message-Id: <201204101353.q3ADr4G8013445@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Tue, 10 Apr 2012 15:53:04 +0200 Subject: [PATCH] Fix PR tree-optimization/52870 (another crash in SLP pattern detection) To: patches@linaro.org Date: Tue, 10 Apr 2012 15:53:04 +0200 (CEST) From: "Ulrich Weigand" X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 x-cbid: 12041013-4966-0000-0000-000001FBA39F X-Gm-Message-State: ALoCoQmLbimg6lzeKQfPxZmScArIp0d+828lXtkQuo1CQOkLmC0n7U1UcK5OSQru7EvW/iAZo8+u http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00360.html ChangeLog: gcc/ PR tree-optimization/52870 * tree-vect-patterns.c (vect_recog_widen_mult_pattern): Verify that presumed pattern statement is within the same loop or basic block. gcc/testsuite/ PR tree-optimization/52870 * gcc.dg/vect/pr52870.c: New test. === added file 'gcc/testsuite/gcc.dg/vect/pr52870.c' --- gcc/testsuite/gcc.dg/vect/pr52870.c 1970-01-01 00:00:00 +0000 +++ gcc/testsuite/gcc.dg/vect/pr52870.c 2012-04-04 16:18:08 +0000 @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-vectorize" } */ + +long +test (int *x) +{ + unsigned long sx, xprec; + + sx = *x >= 0 ? *x : -*x; + + xprec = sx * 64; + + if (sx < 16384) + foo (sx); + + return xprec; +} === modified file 'gcc/tree-vect-patterns.c' --- gcc/tree-vect-patterns.c 2012-02-17 16:18:02 +0000 +++ gcc/tree-vect-patterns.c 2012-04-04 16:18:08 +0000 @@ -564,6 +564,16 @@ VEC (tree, heap) *dummy_vec; bool op1_ok; bool promotion; + loop_vec_info loop_vinfo; + struct loop *loop = NULL; + bb_vec_info bb_vinfo; + stmt_vec_info stmt_vinfo; + + stmt_vinfo = vinfo_for_stmt (last_stmt); + loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo); + bb_vinfo = STMT_VINFO_BB_VINFO (stmt_vinfo); + if (loop_vinfo) + loop = LOOP_VINFO_LOOP (loop_vinfo); if (!is_gimple_assign (last_stmt)) return NULL; @@ -635,6 +645,11 @@ || gimple_assign_rhs_code (use_stmt) != NOP_EXPR) return NULL; + if (!gimple_bb (use_stmt) + || (loop && !flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))) + || (!loop && gimple_bb (use_stmt) != BB_VINFO_BB (bb_vinfo))) + return NULL; + use_lhs = gimple_assign_lhs (use_stmt); use_type = TREE_TYPE (use_lhs); if (!INTEGRAL_TYPE_P (use_type)