From patchwork Thu Nov 1 16:18:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 991984 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-488831-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="gWJ8IqLV"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NbB4SOJ3"; 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 42m9PX4nTKzB4YW for ; Fri, 2 Nov 2018 03:18:55 +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 :mime-version:references:in-reply-to:from:date:message-id :subject:to:cc:content-type; q=dns; s=default; b=n++5AI1Kn89erzz EmnY4OzRj8is/QjmX9fLW4nYufqGXflHGTvCjktLIWapo5WP3Y3IdB7hAXCos+/Y abGA9XBDEDAgBpAZfUraGiPwaNl72A3rN8Y/bwHNMTru/MYie0XHLi6fqyrRnOJ+ uu1wC/y0qP7x9HycgxjrZM1A+nXk= 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 :mime-version:references:in-reply-to:from:date:message-id :subject:to:cc:content-type; s=default; bh=zaME4jqFfdCOzoJJtYx6y c0Ze+k=; b=gWJ8IqLV3+JkocTiJqHEQmxskI8DxGWKur2UqcFbZgfWkAYV7Hsq6 LFwj826+Y07x1uRYlGJ1+wQJU7BXsRi78uyoTrVle28cKKrPz+gROtx7E97sFjn2 oYNqvP1B5I5c4eU2gWtKl0/wf4HACV81Qzf2sSXpxg3vSrol3A/e8U= Received: (qmail 116783 invoked by alias); 1 Nov 2018 16:18:48 -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 116771 invoked by uid 89); 1 Nov 2018 16:18:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=hits, nonexistent, sk:accumul, HX-Received:sk:a15-v6m X-HELO: mail-it1-f178.google.com Received: from mail-it1-f178.google.com (HELO mail-it1-f178.google.com) (209.85.166.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Nov 2018 16:18:46 +0000 Received: by mail-it1-f178.google.com with SMTP id p11-v6so2549149itf.0 for ; Thu, 01 Nov 2018 09:18:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eboyB03AOd9GKsfvb6Q6Y8UgHNhaicAn8bWUObl511Y=; b=NbB4SOJ37pXdjUdJdquoREJxZ/irNejQ1Ma+XBLZzPiw5aH6/1euo4tUmR793zjPr2 2VnQVMUymLFTq9ZPOaGYwrPOyyAjLLXE8iiCx4TKUWPwSDJfPsnzNli1f6KJgeMr2Z1e JyeuUznpV6ULDAA/KRMmVXiARoBHShMzDeG0AOi5FlfihvqOhUCZX+pyLMQMxrj3vItL uwyzuH+5XhQ7Xh3nhz0rs8JJjAL9fn/72BJC9sQmWth0mjgzXC3+G5H2kZqBHmkIxc9Q hiVYlIsFngk3l3xqBEGQIuTrzi0BZZ664xDQMVL0xqk3SekzmsjyCt9R5DwSyeGQQ5Id +CFA== MIME-Version: 1.0 References: In-Reply-To: From: Uros Bizjak Date: Thu, 1 Nov 2018 17:18:33 +0100 Message-ID: Subject: [PATCH v2, middle end]: Fix PR58372, internal compiler error: ix86_compute_frame_layout To: "gcc-patches@gcc.gnu.org" Cc: "H. J. Lu" , "Guo, Xuepeng" , Jakub Jelinek Hello! v2 of the patch hits the real problem: in pass_expand::execute finish_eh_generation is called after expand_stack_alignment is called. Construction of SjLj landing pads calls emit_library_call, which can change crtl->preferred_stack_boundary value after all dependant variables are already calculated by expand_stack_alignment. The solution is to move the call to finish_eh_generation in front of the call to expand_stack_alignment. 2018-11-01 Uros Bizjak PR middle-end/58372 * cfgexpand.c (pass_expand::execute): Move the call to finish_eh_generation in front of the call to expand_stack_alignment. testsuite/ChangeLog: 2018-11-01 Uros Bizjak PR middle-end/58372 * g++.target/i386/pr58372.C: New test. Patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}, all default languages plus go. Additionally, the testcase from PR (and a couple of similar ones) were compiled for i686-w64-mingw32 target with various combinations of -mpreferred-stack-boundary= -mincoming-stack-boundary= -mforce-drap and -m{no-}accumulate-outgoing-args. OK for mainline and release branches? Uros. Index: cfgexpand.c =================================================================== --- cfgexpand.c (revision 265582) +++ cfgexpand.c (working copy) @@ -6510,6 +6510,12 @@ pass_expand::execute (function *fun) find_many_sub_basic_blocks (blocks); purge_all_dead_edges (); + /* After initial rtl generation, call back to finish generating + exception support code. We need to do this before cleaning up + the CFG as the code does not expect dead landing pads. */ + if (fun->eh->region_tree != NULL) + finish_eh_generation (); + expand_stack_alignment (); /* Fixup REG_EQUIV notes in the prologue if there are tailcalls in this @@ -6517,12 +6523,6 @@ pass_expand::execute (function *fun) if (crtl->tail_call_emit) fixup_tail_calls (); - /* After initial rtl generation, call back to finish generating - exception support code. We need to do this before cleaning up - the CFG as the code does not expect dead landing pads. */ - if (fun->eh->region_tree != NULL) - finish_eh_generation (); - /* BB subdivision may have created basic blocks that are are only reachable from unlikely bbs but not marked as such in the profile. */ if (optimize) Index: testsuite/g++.target/i386/pr58372.C =================================================================== --- testsuite/g++.target/i386/pr58372.C (nonexistent) +++ testsuite/g++.target/i386/pr58372.C (working copy) @@ -0,0 +1,9 @@ +/* PR target/58372 */ +/* { dg-do compile { target c++14 } } */ +/* { dg-options "-O2" } */ + +__attribute__ ((__target__ ("rdrnd"))) +void f (unsigned int *b) noexcept +{ + __builtin_ia32_rdrand32_step (b); +}