From patchwork Tue Aug 27 17:46:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 1154001 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-507793-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="KBkAbWmb"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kp7puKZM"; 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 46HxBd1Nb3z9sDQ for ; Wed, 28 Aug 2019 03:46:31 +1000 (AEST) 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:from:date:message-id:subject:to:cc:content-type; q=dns; s=default; b=GCtxvkCyCl9w8Frjm4sL49gngghPsRl+0B8x9koMWLo fyYHoN0qECM5wf7i0qyfgvSbxBHD2YgWmN4tiUGQFO0vMX9wT7QOgg273fdACcVW B+KeKzqNMEUr1+/18h/vvOQTsX60DFJGY5lDA/y6v6rggue/2yiTG3WcX+dlhOqQ = 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:from:date:message-id:subject:to:cc:content-type; s=default; bh=Amn3waZgE0lKs2c9T5Q4wYQEO8I=; b=KBkAbWmbPjQwNSeaQ p+YIEdLQt0F+73UTM9luXEif3uCVHV0kNiIZeKe1eTdazLzQBiFvYFjIOn/wMtc4 vMHy2GdYRRu8fr+VsDkj+COPXbRWqLLRvidQtC29WUDC1hCdcAHO3bIokGOzhs+J GsZi6nJBicBbhv5F98+MYeiFH8= Received: (qmail 106761 invoked by alias); 27 Aug 2019 17:46: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 106752 invoked by uid 89); 27 Aug 2019 17:46:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.3 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.1 spammy= X-HELO: mail-io1-f47.google.com Received: from mail-io1-f47.google.com (HELO mail-io1-f47.google.com) (209.85.166.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Aug 2019 17:46:22 +0000 Received: by mail-io1-f47.google.com with SMTP id j5so125130ioj.8 for ; Tue, 27 Aug 2019 10:46:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=CPEtfHpxbpzX2q7cguR7D4UZCZ+Mb7oeycUT6VOldTo=; b=kp7puKZM3Lf3crUwee6cMSJcVBNGsSPCsuT9nnhLIOER8Se8pYwTPLbUVh4Lopd/oR tSrub76heyQCWwWKuTq781d1wSwqt6AKZ/YMZMmmYd2DI7jYZdZyvd2f4MSiNVkF5e7b C6d/YeaRw3kj+ZgonRWWCMqdy20bEccrxTRb9oziVZkMeznlCKqYVTz1SWVZNwlfo24V TYy3gVfyIB7Kqwou9iKq6NwtDaVm7peXJUSDusEDAoxI9GZFetrJnUag0RZKVE0NIdV2 VUERQlqxpO1TlrMmZjlTxMGrkL1HQY9BPQmcVGT27dE03SjivnfrG0rJXXXcDXiX1ETE NGCA== MIME-Version: 1.0 From: Uros Bizjak Date: Tue, 27 Aug 2019 19:46:09 +0200 Message-ID: Subject: [PATCH, i386]: Fix PR 91528, ICE in ix86_expand_prologue To: "gcc-patches@gcc.gnu.org" Cc: Richard Biener When stack alignment is increased in convert_scalars_to_vector, we have to update several other dependant fields in crtl struct, similar to what expand_stack_alignment from cfgexpand.c does. 2019-08-27 Uroš Bizjak PR target/91528 * config/i386/i386-features.c (convert_scalars_to_vector): Update crtl->stack_realign_needed, crtl->stack_realign_tried and crtl->stack_realign_processed. Update crtl->drap_reg by calling targetm.calls.get_drap_rtx. If drap_rtx is non-null then Update crtl->args.internal_arg_pointer and call fixup_tail_calls. testsuite/ChangeLog: 2019-08-27 Uroš Bizjak PR target/91528 * gcc.target/i386/pr91528.c: New test. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Committed to mainline SVN. Uros. Index: config/i386/i386-features.c =================================================================== --- config/i386/i386-features.c (revision 274958) +++ config/i386/i386-features.c (working copy) @@ -1651,6 +1651,32 @@ convert_scalars_to_vector (bool timode_p) crtl->stack_alignment_needed = 128; if (crtl->stack_alignment_estimated < 128) crtl->stack_alignment_estimated = 128; + + crtl->stack_realign_needed + = INCOMING_STACK_BOUNDARY < crtl->stack_alignment_estimated; + crtl->stack_realign_tried = crtl->stack_realign_needed; + + crtl->stack_realign_processed = true; + + if (!crtl->drap_reg) + { + rtx drap_rtx = targetm.calls.get_drap_rtx (); + + /* stack_realign_drap and drap_rtx must match. */ + gcc_assert ((stack_realign_drap != 0) == (drap_rtx != NULL)); + + /* Do nothing if NULL is returned, + which means DRAP is not needed. */ + if (drap_rtx != NULL) + { + crtl->args.internal_arg_pointer = drap_rtx; + + /* Call fixup_tail_calls to clean up + REG_EQUIV note if DRAP is needed. */ + fixup_tail_calls (); + } + } + /* Fix up DECL_RTL/DECL_INCOMING_RTL of arguments. */ if (TARGET_64BIT) for (tree parm = DECL_ARGUMENTS (current_function_decl); Index: testsuite/gcc.target/i386/pr91528.c =================================================================== --- testsuite/gcc.target/i386/pr91528.c (nonexistent) +++ testsuite/gcc.target/i386/pr91528.c (working copy) @@ -0,0 +1,14 @@ +/* PR target/91528 */ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-Os -mavx512vbmi2 -mforce-drap" } */ + +extern long int labs (long int j); + +int +main () +{ + long *a = (long *)"empty"; + int i = 1441516387; + a[i] = labs (a[i]); + return 0; +}