From patchwork Tue Sep 26 07:30:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 818487 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-462930-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="o07s3gX6"; 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 3y1XgZ202Vz9tXd for ; Tue, 26 Sep 2017 17:31:04 +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=iSFT1OUsfqjtkrRQRopZRqCXW7cO1iCh2fQ/Zofq1yIvR8rKmGxVX Nv6aMNiO0QeAVFCda+3ACldfRIXOzkNKwGSzcq+6eBkgZSz+pzPEbNiL70N/Yn56 OBZ7DsPqBy6cJWakmHqgSZnYHWQ99KQcPJfRcwi2Ks4+TEF48sYpLQ= 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=F82wrvTUvB0o8IfkOlAb566CFr8=; b=o07s3gX6OIGod4hAsnTE C5HNaYD4LoE/+KPctsWgazMlKzixK9omWmdmZOqv3c5L+A1Y9z+j5OurmyPoPFUh 1hVRSP33XAUXoymOJqxPei5VnPu0AvyRPGhRctnuNeGLCId7q2LqM/6zusQhDWd8 AktBvtIg4CWdACKeWiC3LKs= Received: (qmail 19075 invoked by alias); 26 Sep 2017 07:30:35 -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 19026 invoked by uid 89); 26 Sep 2017 07:30:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1676, Changing 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; Tue, 26 Sep 2017 07:30:20 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8775DAD8A for ; Tue, 26 Sep 2017 07:30:18 +0000 (UTC) Date: Tue, 26 Sep 2017 09:30:18 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR82320 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Bootstrapped and tested on x86_64-unkown-linux-gnu, applied. Richard. 2017-09-26 Richard Biener PR tree-optimization/82320 * tree-ssa-sccvn.c (set_ssa_val_to): Changing undef to undef isn't a change. * gcc.dg/torture/pr82320.c: New testcase. Index: gcc/tree-ssa-sccvn.c =================================================================== --- gcc/tree-ssa-sccvn.c (revision 253149) +++ gcc/tree-ssa-sccvn.c (working copy) @@ -3355,6 +3355,12 @@ set_ssa_val_to (tree from, tree to) if (currval != to && !operand_equal_p (currval, to, 0) + /* Different undefined SSA names are not actually different. See + PR82320 for a testcase were we'd otherwise not terminate iteration. */ + && !(TREE_CODE (currval) == SSA_NAME + && TREE_CODE (to) == SSA_NAME + && ssa_undefined_value_p (currval, false) + && ssa_undefined_value_p (to, false)) /* ??? For addresses involving volatile objects or types operand_equal_p does not reliably detect ADDR_EXPRs as equal. We know we are only getting invariant gimple addresses here, so can use Index: gcc/testsuite/gcc.dg/torture/pr82320.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr82320.c (nonexistent) +++ gcc/testsuite/gcc.dg/torture/pr82320.c (working copy) @@ -0,0 +1,39 @@ +/* { dg-do compile } */ + +void +ec (int n4, short int ea) +{ + if (1) + { + if (ea != 0) + { + int *c1 = (int *)&ea; + +nn: + for (;;) + ++*c1; + } + } + else + { + int *lq = &n4; + int *md; + int da; + + goto nn; + +r1: + md = lq; + for (da = 0; da < 1; ++da) + { +ig: + ++n4; + *md += n4; + } + } + + for (ea = 0; ea < 1; ++ea) + goto r1; + + goto ig; +}