From patchwork Thu Jan 11 13:41:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 859120 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-470834-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="PpZQs231"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zHRqF049Bz9t3Z for ; Fri, 12 Jan 2018 00:41:12 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=KMoFrKogg2zb0RxRyuLSHswZeZwf5L5FahYGYZfrDifPnsmiCbnva nNbvkGmiHZ6gNmon6Qg37pEMNlbDC8gPs0bGs6suJUJHxk4ToBzuXuFJ61dnA4j9 g/elnut/wDH9dCe1aiQa9ZLw4Ckys0JNZ8nP6ggkxxXK3H6l7eQJRs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=BsWcOFWB+HfzMG6AkRLkmPPtWN0=; b=PpZQs231RR/xpmv1wZHH lWWdj22OZXQkQJEa70TWFT7tzthw0u5fiN+HGqHd//8EiSgrfDIar7dc2C72xUBo FnBTJILqdrBby1MqR/3Li3eoJyRpLwVkW4Ydoty+xKNAYKfZTIkA7uNAhwGqM1Aw Ysy6+iXw3eE8X3WVnhLCXN4= Received: (qmail 31324 invoked by alias); 11 Jan 2018 13:41:05 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 31224 invoked by uid 89); 11 Jan 2018 13:41:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.6 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=susceptible, Hx-languages-length:2700 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 11 Jan 2018 13:41:03 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 345B3AD8B for ; Thu, 11 Jan 2018 13:41:01 +0000 (UTC) Date: Thu, 11 Jan 2018 14:41:01 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR83435 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 The following fixes VRP to be less susceptible to TREE_OVERFLOW in the GIMPLE IL (which we don't really want...). It also fixes fallout from my earlier graphite fixes (look better at this stage than ignoring fake edges when computing loop exists everywhere...). Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2018-01-11 Richard Biener PR tree-optimization/83435 * graphite.c (canonicalize_loop_form): Ignore fake loop exit edges. * graphite-scop-detection.c (scop_detection::get_sese): Likewise. * tree-vrp.c (add_assert_info): Drop TREE_OVERFLOW if they appear. * gcc.dg/graphite/pr83435.c: New testcase. Index: gcc/graphite.c =================================================================== --- gcc/graphite.c (revision 256479) +++ gcc/graphite.c (working copy) @@ -324,7 +324,7 @@ canonicalize_loop_form (void) FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { edge e = single_exit (loop); - if (!e || (e->flags & EDGE_COMPLEX)) + if (!e || (e->flags & (EDGE_COMPLEX|EDGE_FAKE))) continue; canonicalize_loop_closed_ssa (loop, e); Index: gcc/graphite-scop-detection.c =================================================================== --- gcc/graphite-scop-detection.c (revision 256479) +++ gcc/graphite-scop-detection.c (working copy) @@ -428,7 +428,7 @@ scop_detection::get_sese (loop_p loop) edge scop_begin = loop_preheader_edge (loop); edge scop_end = single_exit (loop); - if (!scop_end || (scop_end->flags & EDGE_COMPLEX)) + if (!scop_end || (scop_end->flags & (EDGE_COMPLEX|EDGE_FAKE))) return invalid_sese; /* Include the BB with the loop-closed SSA PHI nodes. canonicalize_loop_closed_ssa makes sure that is in proper shape. */ Index: gcc/tree-vrp.c =================================================================== --- gcc/tree-vrp.c (revision 256479) +++ gcc/tree-vrp.c (working copy) @@ -2786,6 +2786,8 @@ add_assert_info (vec &asser assert_info info; info.comp_code = comp_code; info.name = name; + if (TREE_OVERFLOW_P (val)) + val = drop_tree_overflow (val); info.val = val; info.expr = expr; asserts.safe_push (info); Index: gcc/testsuite/gcc.dg/graphite/pr83435.c =================================================================== --- gcc/testsuite/gcc.dg/graphite/pr83435.c (nonexistent) +++ gcc/testsuite/gcc.dg/graphite/pr83435.c (working copy) @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-parallelize-loops=2 -floop-parallelize-all" } */ + +int yj, ax; + +void +gf (signed char mp) +{ + int *dh = &yj; + + for (;;) + { + signed char sb; + + for (sb = 0; sb < 1; sb -= 8) + { + } + + mp &= mp <= sb; + if (mp == 0) + dh = &ax; + mp = 0; + *dh = 0; + } +}