From patchwork Mon May 13 10:45:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 243357 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id BA1842C009F for ; Mon, 13 May 2013 20:45:31 +1000 (EST) 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:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=kSnIqtmmCT+Rctu3SJUJl/3I2nS97+mwppVW6MXE0gP2WEW0bN 94t51D9BdvYqVgXv9aBgypjE4vsbZhgl2/kmUU+rWkkOa977qCCEkjtKx1rcluXQ NVS2Uqtj7MJ98KloWuj/xM392bCvO1K0jtdUdL/jSbepnr6USyw33wnQ8= 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:cc:subject:message-id:mime-version:content-type; s= default; bh=+Y3ibrcsXdyvEzkVFW0QupUmXPU=; b=a7aOQk/cnL/tP27yMcex 9z1HsS/hlJ+a5k+9wT2/2pQQHJQ38FLKGm12ZEEtfG4NW/Fl0DSg0EsT2wqwN9Uy z26XkUhsA7/tiINdcSj7NC7eP3b3Hu9ORBLT6RVzqj8fr5mXa+nWlI7un1pZkMTy r2TlM6QK7uZ6LsnbYm3Gkvw= Received: (qmail 6016 invoked by alias); 13 May 2013 10:45:25 -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 5979 invoked by uid 89); 13 May 2013 10:45:22 -0000 X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, TW_VP autolearn=ham version=3.3.1 Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 13 May 2013 10:45:18 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6A705A5077; Mon, 13 May 2013 12:45:16 +0200 (CEST) Date: Mon, 13 May 2013 12:45:16 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Cc: Jakub Jelinek Subject: [PATCH] Fix PR57235 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 This fixes a virtual SSA updating problem with sinking clobbers. Namely when sinking into a block with multiple predecessors and no virtual use we lack a convenient PHI node that serves as a merge of the virtual operands from the predecessors. The following patch gives up sinking clobbers in this case (alternatively we can remove all clobbers). Any preference here? I'm wondering when sinking a clobber into a block with multiple preds is good. Bootstrapped and tested on x86_64-unknown-linux-gnu. Thanks, Richard. 2013-05-13 Richard Biener PR middle-end/57235 * tree-eh.c (sink_clobbers): Give up for successors with multiple predecessors and no virtual uses. * g++.dg/torture/pr57235.C: New testcase. Index: gcc/tree-eh.c =================================================================== --- gcc/tree-eh.c (revision 198815) +++ gcc/tree-eh.c (working copy) @@ -3360,6 +3360,11 @@ sink_clobbers (basic_block bb) } } + /* ??? If we have multiple predecessors but no virtual PHI we cannot + easily update virtual SSA form. */ + if (!vphi && !single_pred_p (succbb)) + return 0; + dgsi = gsi_after_labels (succbb); gsi = gsi_last_bb (bb); for (gsi_prev (&gsi); !gsi_end_p (gsi); gsi_prev (&gsi)) Index: gcc/testsuite/g++.dg/torture/pr57235.C =================================================================== --- gcc/testsuite/g++.dg/torture/pr57235.C (revision 0) +++ gcc/testsuite/g++.dg/torture/pr57235.C (working copy) @@ -0,0 +1,156 @@ +// { dg-do compile } + +namespace std +{ + template < class _Elem > struct char_traits + { + }; + struct _Container_base + { + }; + template < class _Ty > struct _Allocator_base + { + }; + template < class _Ty > class allocator:public _Allocator_base < _Ty > + { + }; + class _String_base:public _Container_base + { + }; +template < class _Ty, class _Alloc > class _String_val:public _String_base + { + }; +template < class _Elem, class _Traits, class _Ax > class basic_string:public _String_val < _Elem, + _Ax + > + { + public:typedef basic_string < _Elem, _Traits, _Ax > _Myt; + typedef _String_val < _Elem, _Ax > _Mybase; + basic_string (const _Elem * _Ptr):_Mybase () + { + } + }; + typedef basic_string < char, char_traits < char >, + allocator < char > >string; +} + + +namespace google +{ + namespace protobuf + { + namespace internal + { + template < class C > class scoped_ptr + { + public:typedef C element_type; + explicit scoped_ptr (C * p = __null):ptr_ (p) + { + } + ~scoped_ptr () + { + delete ptr_; + } + C *get () const + { + return ptr_; + } + private: C * ptr_; + }; + } + using internal::scoped_ptr; + enum LogLevel + { + LOGLEVEL_INFO, LOGLEVEL_WARNING, LOGLEVEL_ERROR, LOGLEVEL_FATAL, + LOGLEVEL_DFATAL = LOGLEVEL_ERROR + }; + namespace internal + { + class LogMessage + { + public:LogMessage (LogLevel level, const char *filename, + int line); + ~LogMessage (); + LogMessage & operator<< (const std::string & value); + }; + class LogFinisher + { + public:void operator= (LogMessage & other); + }; + } + using namespace std; + class Descriptor + { + }; + class FieldDescriptor + { + public: + const Descriptor *message_type () const; + string DebugString () const; + }; + class MessageLite + { + }; + class Message:public MessageLite + { + public:inline Message () + { + } + virtual ~ Message (); + virtual Message *New () const = 0; + }; + class MessageFactory + { + }; + class UnknownFieldSet + { + }; + class DynamicMessageFactory:public MessageFactory + { + public:DynamicMessageFactory (); + const Message *GetPrototype (const Descriptor * type); + }; + namespace io + { + class ErrorCollector + { + public:inline ErrorCollector () + { + } + virtual ~ ErrorCollector (); + }; + } + class DescriptorBuilder + { + class OptionInterpreter + { + bool SetAggregateOption (const FieldDescriptor * option_field, + UnknownFieldSet * unknown_fields); + DynamicMessageFactory dynamic_factory_; + }; + }; + namespace + { + class AggregateErrorCollector:public io::ErrorCollector + { + }; + } + bool DescriptorBuilder::OptionInterpreter:: + SetAggregateOption (const FieldDescriptor * option_field, + UnknownFieldSet * unknown_fields) + { + const Descriptor *type = option_field->message_type (); + scoped_ptr < Message > + dynamic (dynamic_factory_.GetPrototype (type)->New ()); + !(!(dynamic.get () != + __null)) ? (void) 0 : ::google::protobuf::internal:: + LogFinisher () =::google::protobuf::internal::LogMessage (::google:: + protobuf:: + LOGLEVEL_FATAL, + "descriptor.cc", + 4396) << + option_field->DebugString (); + AggregateErrorCollector collector; + } + } +}