From patchwork Fri Sep 19 19:36:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 391378 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 2E184140161 for ; Sat, 20 Sep 2014 05:36:27 +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:subject:message-id:mime-version:content-type; q=dns; s= default; b=hCiqAKZntu+aETVQ4nz/73lUuMowjqc6l8eNplSdX6sPg1YT9KlDK 2zjlSHXgXC9uYqNJg5Hr5xDrd6FCcKfHO9GECKIL6WmkEM7ElViE0aQU6XPx0yr+ 7FTCMZxTfTD3htUaaBHrKO7dh+9W/9RdzbOOMbG1i15IexscpZH1B8= 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:subject:message-id:mime-version:content-type; s= default; bh=4mrqSdNY+KCJbwDVb/VHHmu9CDc=; b=ZsTpupHLFjpeV6ImdbXN hhG+Q6zwYA2gHMd53lCXoBVGyzAAgekpCty+FkUPOR59f4mqNhovMdnY2fs/n1eO Yidu1KkNGdo0TszptF7rHti18I/+l5ac0Rwrflcs0nI3U9HWQ7qXT8uFo1dR+nf8 /c57V2Cl3YYWhcSmktC+4Rs= Received: (qmail 19205 invoked by alias); 19 Sep 2014 19:36:19 -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 19193 invoked by uid 89); 19 Sep 2014 19:36:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f44.google.com Received: from mail-pa0-f44.google.com (HELO mail-pa0-f44.google.com) (209.85.220.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 19 Sep 2014 19:36:17 +0000 Received: by mail-pa0-f44.google.com with SMTP id rd3so709997pab.31 for ; Fri, 19 Sep 2014 12:36:15 -0700 (PDT) X-Received: by 10.67.15.71 with SMTP id fm7mr4342306pad.45.1411155375122; Fri, 19 Sep 2014 12:36:15 -0700 (PDT) Received: from msticlxl57.ims.intel.com (fmdmzpr02-ext.fm.intel.com. [192.55.55.37]) by mx.google.com with ESMTPSA id dg9sm2589528pdb.50.2014.09.19.12.36.13 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Sep 2014 12:36:14 -0700 (PDT) Date: Fri, 19 Sep 2014 23:36:04 +0400 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH] Do not remove labels with LABEL_PRESERVE_P Message-ID: <20140919193604.GA48001@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi, During my work on enabling pseudo PIC register I've found that cfg cleaunp may remove lables with LABEL_PRESERVE_P set to 1. In my case I generated SET_RIP during expand pass and cfg cleanup removed label it used as an operand. Below is a patch that fixes it. It is not actually required for our latest PIC related patch but still seems to make sense. Bootstrapped and tested on linux-x86_64. Thanks, Ilya --- 2014-09-19 Ilya Enkovich * cfgcleanup.c (try_optimize_cfg): Do not remove label with LABEL_PRESERVE_P flag set. diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index a008168..9325ea0 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -2701,6 +2701,7 @@ try_optimize_cfg (int mode) && (single_pred_edge (b)->flags & EDGE_FALLTHRU) && !(single_pred_edge (b)->flags & EDGE_COMPLEX) && LABEL_P (BB_HEAD (b)) + && !LABEL_PRESERVE_P (BB_HEAD (b)) /* If the previous block ends with a branch to this block, we can't delete the label. Normally this is a condjump that is yet to be simplified, but