From patchwork Wed Oct 18 10:48:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 827526 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-464418-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="hLB8kBwO"; 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 3yH81v2bdCz9t39 for ; Wed, 18 Oct 2017 21:49:06 +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:from :to:cc:subject:date:message-id; q=dns; s=default; b=MmuDHvC/4jCf u1xmBNa5Wo78wRvzeFbGQMtYiQEZj1BNpUocdV0BY9COpGFc9oLpzqFm3dAI2KaT POXJI0y0GjFVDQon4pVtRYxb970CJY/GYPoHfNTPS/yb07lBo4a6ESmshyqhCdG2 1yU4ZjMcb88g8HGl/vMbS4AVISbvlRA= 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:from :to:cc:subject:date:message-id; s=default; bh=Be53A++nXlCC7pozA0 uaSdzs5q8=; b=hLB8kBwO4fagZiISSRLT/dNx2KNAEn+DBvVhMgzsu28CR+nP3i TVcjZkUP/Wf04zAAdSksp2CJBbb33Bi8Opjm/AY6Qugsmi4y8VsPUzMbM4YC8JA1 iRaNVHoUCZKLtiKr2+fWKVMl/Mh2nxVZzxervBen0Y8HRttjAfLWtDc7E= Received: (qmail 56508 invoked by alias); 18 Oct 2017 10:48:44 -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 56360 invoked by uid 89); 18 Oct 2017 10:48:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:880 X-HELO: gcc1-power7.osuosl.org Received: from gcc1-power7.osuosl.org (HELO gcc1-power7.osuosl.org) (140.211.15.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Oct 2017 10:48:37 +0000 Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id 93AE512402F2; Wed, 18 Oct 2017 10:48:35 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: vmakarov@redhat.com, Segher Boessenkool Subject: [PATCH] ira: volatile asm's are not moveable (PR82602) Date: Wed, 18 Oct 2017 10:48:17 +0000 Message-Id: <3e892c8c892b5c25be867658e16fc59b485bf07a.1508322746.git.segher@kernel.crashing.org> X-IsSubscribed: yes A volatile asm statement can not be moved (relative to other volatile asm, etc.), but IRA could do it nevertheless. This patch fixes it. Testing on powerpc64-linux {-m32,-m64}; okay if it succeeds? Also for backports? Segher 2017-10-18 Segher Boessenkool PR rtl-optimization/82602 * ira.c (rtx_moveable_p): Return false for volatile asm. --- gcc/ira.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/ira.c b/gcc/ira.c index 046ce3b..8c93d3d 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -4400,6 +4400,12 @@ rtx_moveable_p (rtx *loc, enum op_type type) for a reason. */ return false; + case ASM_OPERANDS: + /* The same is true for volatile asm: it has unknown side effects, it + cannot be moved at will. */ + if (MEM_VOLATILE_P (x)) + return false; + default: break; }