From patchwork Wed Jan 21 16:41:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 431553 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9AACA1402A0 for ; Thu, 22 Jan 2015 03:41:32 +1100 (AEDT) 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=xL3Ak82cw6FApSsnJxyjlL9NN5yHiQg3yu+6JByfSVsgcl BmPCCjhv32pBA6YzQHwfnVJfwaFRL+02m6kodG0LOWPRWcnO4MGWJ2BJEwTJMdek ZN7ATB0S41kTnQ508PAl44MXxgjARfOnNxbylOtPBJTnbWtMfAR9j5LQsy/jI= 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=d+S6IZyu4Ll9SzH3ttfGuepQD9o=; b=lWqrYackfEa3R6kElXes OFxdttyIXwQiO6EAQoMigFxh0XGvj5YlYOcDXAvInMrmAI8nOh3nC2Y9dhjINbcI SBcVutaYlCLQ6NnmxcM4LUZDlonSlfjjiJNqaLisIqNlkdk9tnQk6Y7SCM3b26/U fFxvC0WnKgDQwlz/r7RZzEY= Received: (qmail 17205 invoked by alias); 21 Jan 2015 16:41:23 -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 17176 invoked by uid 89); 21 Jan 2015 16:41:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 21 Jan 2015 16:41:14 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0LGfC35006201 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 21 Jan 2015 11:41:13 -0500 Received: from anchor.twiddle.net (vpn-229-171.phx2.redhat.com [10.3.229.171]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0LGfClh004475 for ; Wed, 21 Jan 2015 11:41:12 -0500 Message-ID: <54BFD6A7.2000305@redhat.com> Date: Wed, 21 Jan 2015 08:41:11 -0800 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: GCC Patches Subject: [COMMITTED] Fix target/64669 -- aarch64 profilebootstrap failure X-IsSubscribed: yes As discussed in the PR, we're committing a layering violation here. Removing that violation fixes the ICE, which is the most important thing for the moment. Reviewing objdump of the stage3 cc1plus, about 90% of the instances of ccmp instruction are followed by a conditional branch, so combine is usually performing the optimization that the code being removed indended. But there are some instances that aren't optimized, so I opened pr64713 to track that. r~ PR target/64669 * ccmp.c (used_in_cond_stmt_p): Remove. (expand_ccmp_expr): Don't use it. diff --git a/gcc/ccmp.c b/gcc/ccmp.c index 903d5a8..5d17554 100644 --- a/gcc/ccmp.c +++ b/gcc/ccmp.c @@ -90,9 +90,8 @@ along with GCC; see the file COPYING3. If not see - gen_ccmp_first expands the first compare in CCMP. - gen_ccmp_next expands the following compares. - * If the final result is not used in a COND_EXPR (checked by function - used_in_cond_stmt_p), it calls cstorecc4 pattern to store the CC to a - general register. + * We use cstorecc4 pattern to convert the CCmode intermediate to + the integer mode result that expand_normal is expecting. Since the operands of the later compares might clobber CC reg, we do not emit the insns during expand. We keep the insn sequences in two seq @@ -156,31 +155,6 @@ ccmp_candidate_p (gimple g) return false; } -/* Check whether EXP is used in a GIMPLE_COND statement or not. */ -static bool -used_in_cond_stmt_p (tree exp) -{ - bool expand_cond = false; - imm_use_iterator ui; - gimple use_stmt; - FOR_EACH_IMM_USE_STMT (use_stmt, ui, exp) - if (gimple_code (use_stmt) == GIMPLE_COND) - { - tree op1 = gimple_cond_rhs (use_stmt); - if (integer_zerop (op1)) - expand_cond = true; - BREAK_FROM_IMM_USE_STMT (ui); - } - else if (gimple_code (use_stmt) == GIMPLE_ASSIGN - && gimple_expr_code (use_stmt) == COND_EXPR) - { - if (gimple_assign_rhs1 (use_stmt) == exp) - expand_cond = true; - } - - return expand_cond; -} - /* PREV is the CC flag from precvious compares. The function expands the next compare based on G which ops previous compare with CODE. PREP_SEQ returns all insns to prepare opearands for compare. @@ -301,20 +275,9 @@ expand_ccmp_expr (gimple g) enum machine_mode cc_mode = CCmode; tree lhs = gimple_assign_lhs (g); - /* TMP should be CC. If it is used in a GIMPLE_COND, just return it. - Note: Target needs to define "cbranchcc4". */ - if (used_in_cond_stmt_p (lhs)) - { - emit_insn (prep_seq); - emit_insn (gen_seq); - return tmp; - } - #ifdef SELECT_CC_MODE cc_mode = SELECT_CC_MODE (NE, tmp, const0_rtx); #endif - /* If TMP is not used in a GIMPLE_COND, store it with a csctorecc4_optab. - Note: Target needs to define "cstorecc4". */ icode = optab_handler (cstore_optab, cc_mode); if (icode != CODE_FOR_nothing) { diff --git a/gcc/testsuite/g++.dg/torture/pr64669.C b/gcc/testsuite/g++.dg/torture/pr64669.C new file mode 100644 index 0000000..b207739 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr64669.C @@ -0,0 +1,63 @@ +typedef unsigned int source_location; +typedef source_location location_t; +extern void error_at (location_t, const char *, ...) + __attribute__ ((__format__ (__gcc_tdiag__, 2, 3))) + __attribute__ ((__nonnull__ (2))); + +class Lex +{ + static int fetch_char (const char *str, unsigned int *value); + location_t location () const; + const char *advance_one_utf8_char (const char *, unsigned int *, bool *); + const char *advance_one_char (const char *, bool, unsigned int *, bool *); + int lineoff_; + int lineno_; +}; + +int +Lex::fetch_char (const char *p, unsigned int *value) +{ + unsigned char c = *p; + if (c <= 0x7f) + { + return 1; + } + else if ((c & 0xe0) == 0xc0 && (p[1] & 0xc0) == 0x80) + { + *value = (((c & 0x1f) << 6) + (p[1] & 0x3f)); + } + { + *value = (((c & 0xf) << 12) + (p[2] & 0x3f)); + } +} + +const char * +Lex::advance_one_utf8_char (const char *p, unsigned int *value, + bool * issued_error) +{ + *issued_error = false; + if (*p == '\0') + { + *issued_error = true; + return p + 1; + } + int adv = Lex::fetch_char (p, value); + if (*value == 0xfeff && (this->lineno_ != 1 || this->lineoff_ != 0)) + { + *issued_error = true; + } + return p + adv; +} + +const char * +Lex::advance_one_char (const char *p, bool is_single_quote, + unsigned int *value, bool * is_character) +{ + { + bool issued_error; + const char *ret = this->advance_one_utf8_char (p, value, &issued_error); + if (is_single_quote + && (*value == '\'' || *value == '\n') && !issued_error) + error_at (this->location (), "invalid character literal"); + } +}