From patchwork Fri Nov 15 21:12:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 291700 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5DED62C00A4 for ; Sat, 16 Nov 2013 08:12:42 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=by6j/QfG7f+ouz707ZZCnDhL2spzqQ5jQ8TIpRgiwg5PKF dxQlLJHNQLRD3dUF9zWvvgEquvHfra3tZjN/FM/HVV6mVU1z2jtXWEHSYp+TqEqz RV68hfEQgpgdxoQFaZnuZCwWALr5isScBLrgk7FMRYNx9xtY6yFsn6Cvrms5k= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=rA3AMNWGNwj6EODsoj1MHBZU5GU=; b=jtsiOqrsoz3CVtRVx1hW p0asTrgfh2tfg4xmb5LrR0XSVR8sduEgeli/le908ExB2wHts3dpWIi46wzPigMM cJEI6mDHX9GL+nZtjT/qnNWAzWuCnc0z3nD9Ex3iCIEbAnQFT6F4a1USVY41rsJ5 sja9ReNffJ7cmbgYeznMluM= Received: (qmail 23942 invoked by alias); 15 Nov 2013 21:12:32 -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 23929 invoked by uid 89); 15 Nov 2013 21:12:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=AWL, BAYES_50, RDNS_NONE, SPF_HELO_PASS, SPF_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Nov 2013 21:12:30 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAFLCNGL007111 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 15 Nov 2013 16:12:23 -0500 Received: from stumpy.slc.redhat.com (ovpn-113-161.phx2.redhat.com [10.3.113.161]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rAFLCNqp006734 for ; Fri, 15 Nov 2013 16:12:23 -0500 Message-ID: <52868E37.6070600@redhat.com> Date: Fri, 15 Nov 2013 14:12:23 -0700 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: gcc-patches Subject: [PATCH] Cleanup patch for 59127 X-IsSubscribed: yes Based on comments from Richi. This patch tweaks has_abnormal_outgoing_edge to also check for EDGE_EH and changes the name in the obvious way. This allows part of patch for 59127 to go away -- specifically we don't have to check stmt_ends_bb_p and explicitly filter out GIMPLE_RETURN. Bootstrapped and regression tested on x86_64-unknown-linux-gnu. Installed on the trunk. Jeff * basic-block.h (has_abnormal_or_eh_outgoing_edge): Renamed from has_abnormal_or_outgoing_edge. Check for EH edges as well. * gimple-ssa-isolate-paths.c (find_implicit_erroneous_behaviour): Corresponding changes. Do not check stmt_ends_bb_p or GIMPLE_RETURN anymore. (find_explicit_erroneous_behaviour): Likewise. diff --git a/gcc/basic-block.h b/gcc/basic-block.h index b7e3b50..fd16812 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -1012,13 +1012,13 @@ inverse_probability (int prob1) /* Return true if BB has at least one abnormal outgoing edge. */ static inline bool -has_abnormal_outgoing_edge_p (basic_block bb) +has_abnormal_or_eh_outgoing_edge_p (basic_block bb) { edge e; edge_iterator ei; FOR_EACH_EDGE (e, ei, bb->succs) - if (e->flags & EDGE_ABNORMAL) + if (e->flags & (EDGE_ABNORMAL | EDGE_EH)) return true; return false; diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c index 66c13f4..c42f112 100644 --- a/gcc/gimple-ssa-isolate-paths.c +++ b/gcc/gimple-ssa-isolate-paths.c @@ -224,7 +224,7 @@ find_implicit_erroneous_behaviour (void) the trap we insert. We have to preserve abnormal edges out of the isolated block which in turn means updating PHIs at the targets of those abnormal outgoing edges. */ - if (has_abnormal_outgoing_edge_p (bb)) + if (has_abnormal_or_eh_outgoing_edge_p (bb)) continue; /* First look for a PHI which sets a pointer to NULL and which @@ -268,15 +268,8 @@ find_implicit_erroneous_behaviour (void) { /* We only care about uses in BB. Catching cases in in other blocks would require more complex path - isolation code. - - If the statement must end a block and is not a - GIMPLE_RETURN, then additional work would be - necessary to isolate the path. Just punt it for - now. */ - if (gimple_bb (use_stmt) != bb - || (stmt_ends_bb_p (use_stmt) - && gimple_code (use_stmt) != GIMPLE_RETURN)) + isolation code. */ + if (gimple_bb (use_stmt) != bb) continue; if (infer_nonnull_range (use_stmt, lhs)) @@ -316,7 +309,7 @@ find_explicit_erroneous_behaviour (void) the trap we insert. We have to preserve abnormal edges out of the isolated block which in turn means updating PHIs at the targets of those abnormal outgoing edges. */ - if (has_abnormal_outgoing_edge_p (bb)) + if (has_abnormal_or_eh_outgoing_edge_p (bb)) continue; /* Now look at the statements in the block and see if any of @@ -329,8 +322,7 @@ find_explicit_erroneous_behaviour (void) /* By passing null_pointer_node, we can use infer_nonnull_range to detect explicit NULL pointer dereferences and other uses where a non-NULL value is required. */ - if ((!stmt_ends_bb_p (stmt) || gimple_code (stmt) == GIMPLE_RETURN) - && infer_nonnull_range (stmt, null_pointer_node)) + if (infer_nonnull_range (stmt, null_pointer_node)) { insert_trap_and_remove_trailing_statements (&si, null_pointer_node);