From patchwork Mon Nov 5 21:59:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Bosscher X-Patchwork-Id: 197313 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 6A4652C008D for ; Tue, 6 Nov 2012 09:00:23 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1352757623; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: MIME-Version:Received:From:Date:Message-ID:Subject:To:Cc: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=dA+y4t3 HlVg0AMfF1Lnbxt0ve7E=; b=Rh225porQj7J11dxxqeqQtAlmL53WYE/bMOf0zl +D/SQDJkYklD1a5TLgWkXT5Ey3+zfFeNFystvpNQvoYJoQpTAXKPULrw+QElNidO jrpl6tnTRaf6j3WGsmm8y5LtM3zhxJTmZD/HoO4cgIqx47UgpUwF7On3d0SI5BAx 8ZJU= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:MIME-Version:Received:From:Date:Message-ID:Subject:To:Cc:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=T4RAl0s6KmnUXJEQKCezeJ03oHLkXTkuKxDPaLxVVxDy2uItMIVqm+EnVceFkM g+AEbngffGWqp6xp4lNhjIgoGZ9/fjlKLTkQW58WRD8+CMIIncCeSaL14qBhhyp5 vEMbRoSk0gtSphsj/ZicZt8yWYoTiuJ2bJGtJtiOm6wic=; Received: (qmail 26685 invoked by alias); 5 Nov 2012 22:00:16 -0000 Received: (qmail 26670 invoked by uid 22791); 5 Nov 2012 22:00:16 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-la0-f47.google.com (HELO mail-la0-f47.google.com) (209.85.215.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 05 Nov 2012 22:00:07 +0000 Received: by mail-la0-f47.google.com with SMTP id h5so4637599lam.20 for ; Mon, 05 Nov 2012 14:00:06 -0800 (PST) Received: by 10.112.50.205 with SMTP id e13mr4633938lbo.63.1352152806119; Mon, 05 Nov 2012 14:00:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.112.88.99 with HTTP; Mon, 5 Nov 2012 13:59:45 -0800 (PST) From: Steven Bosscher Date: Mon, 5 Nov 2012 22:59:45 +0100 Message-ID: Subject: [patch] PR55191 - ICE in tree-ssa-pre.c due to missing fake edge for an infinite loop To: GCC Patches Cc: Jakub Jelinek X-IsSubscribed: yes 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 Hello, I hadn't expected that cfganal.c's reverse-CFG DFS would actually depend on the order of the basic blocks. The attached patch fixes that small oversight... Bootstrapped&tested on powerpc64-unknown-linux-gnu. OK for trunk? Ciao! Steven * cfganal.c (connect_infinite_loops_to_exit): Call dfs_deadend from here. (flow_dfs_compute_reverse_execute): Don't call it here. Index: cfganal.c =================================================================== --- cfganal.c (revision 193141) +++ cfganal.c (working copy) @@ -452,6 +452,7 @@ void connect_infinite_loops_to_exit (void) { basic_block unvisited_block = EXIT_BLOCK_PTR; + basic_block deadend_block; struct depth_first_search_dsS dfs_ds; /* Perform depth-first search in the reverse graph to find nodes @@ -467,8 +468,9 @@ connect_infinite_loops_to_exit (void) if (!unvisited_block) break; - make_edge (unvisited_block, EXIT_BLOCK_PTR, EDGE_FAKE); - flow_dfs_compute_reverse_add_bb (&dfs_ds, unvisited_block); + deadend_block = dfs_find_deadend (unvisited_block); + make_edge (deadend_block, EXIT_BLOCK_PTR, EDGE_FAKE); + flow_dfs_compute_reverse_add_bb (&dfs_ds, deadend_block); } flow_dfs_compute_reverse_finish (&dfs_ds); @@ -958,7 +960,7 @@ flow_dfs_compute_reverse_execute (depth_first_sear /* Determine if there are unvisited basic blocks. */ FOR_BB_BETWEEN (bb, last_unvisited, NULL, prev_bb) if (!bitmap_bit_p (data->visited_blocks, bb->index)) - return dfs_find_deadend (bb); + return bb; return NULL; } Index: testsuite/gcc.dg/pr55191.c =================================================================== --- testsuite/gcc.dg/pr55191.c (revision 0) +++ testsuite/gcc.dg/pr55191.c (revision 0) @@ -0,0 +1,14 @@ +/* PR tree-optimization/55191 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int a, b; + +void f(void) +{ + b = a || b; + + for(a = 0; a < 2; a++); + while(1); +} +