From patchwork Mon Jul 15 12:49:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1131967 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-505091-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ZIjXkjyg"; 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 45nNdt1h8Hz9s00 for ; Mon, 15 Jul 2019 22:49:35 +1000 (AEST) 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=ELoyq0MTmgYAnIIHiZqjCMNv85838keni7dY/t6IxRwzuGThg7PPW ldUHlooaKEEuYXHV1dvR8J1srTH3/nxF1k+rvd12A/01FVeol1Ildx2QEGAumJ7V zHG5AL9I6yEpcx0YLlKQYn28WsH1sOPMguROMUoISZkhPJuvp5T8Vo= 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=REno3r85yCqTI+BzUJdbadQMAbc=; b=ZIjXkjygAFw28W1CrTlU qKCYVpZMNlfLzOWMxyYWANRCbqueKsVr60CN1NJqVLRiel88hgVD6LOZlIAjzov6 S6LJJipJbv7kcFUn1BCnIJzKHfu/IPbEXUjK4wgUc15lF/booONDUhxIDmB1ez9x znXp0W6Qds7Qi+3uuSAYF2g= Received: (qmail 54040 invoked by alias); 15 Jul 2019 12:49:27 -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 53919 invoked by uid 89); 15 Jul 2019 12:49:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 15 Jul 2019 12:49:26 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0490CAF00 for ; Mon, 15 Jul 2019 12:49:23 +0000 (UTC) Date: Mon, 15 Jul 2019 14:49:23 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR91162 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Bootstrapped / tested on x86_64-unknown-linux-gnu, applied. Richard. 2019-07-15 Richard Biener PR middle-end/91162 * tree-cfg.c (move_block_to_fn): When releasing a virtual PHI node make sure to replace all uses with something valid. * gcc.dg/autopar/pr91162.c: New testcase. Index: gcc/tree-cfg.c =================================================================== --- gcc/tree-cfg.c (revision 273490) +++ gcc/tree-cfg.c (working copy) @@ -7088,7 +7088,14 @@ move_block_to_fn (struct function *dest_ if (virtual_operand_p (op)) { /* Remove the phi nodes for virtual operands (alias analysis will be - run for the new function, anyway). */ + run for the new function, anyway). But replace all uses that + might be outside of the region we move. */ + use_operand_p use_p; + imm_use_iterator iter; + gimple *use_stmt; + FOR_EACH_IMM_USE_STMT (use_stmt, iter, op) + FOR_EACH_IMM_USE_ON_STMT (use_p, iter) + SET_USE (use_p, SSA_NAME_VAR (op)); remove_phi_node (&psi, true); continue; } Index: gcc/testsuite/gcc.dg/autopar/pr91162.c =================================================================== --- gcc/testsuite/gcc.dg/autopar/pr91162.c (nonexistent) +++ gcc/testsuite/gcc.dg/autopar/pr91162.c (working copy) @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-parallelize-loops=2 -fno-tree-dominator-opts --param parloops-min-per-thread=30" } */ + +void +zf (__int128 ct) +{ + __int128 *rk = &ct; + + if (0) + { + int jj; + +t9: + for (jj = 0; jj < 60; ++jj) + { + } + + __builtin_unreachable (); + } + + while (*rk < 1) + ++*rk; + + goto t9; +}