From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10198 invoked by alias); 26 Sep 2014 16:13:05 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 10187 invoked by uid 89); 26 Sep 2014 16:13:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS 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; Fri, 26 Sep 2014 16:13:03 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8QGCx2G015728 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 26 Sep 2014 12:12:59 -0400 Received: from stumpy.slc.redhat.com ([10.3.113.8]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8QGCwtv011556; Fri, 26 Sep 2014 12:12:59 -0400 Message-ID: <5425908A.3090808@redhat.com> Date: Fri, 26 Sep 2014 16:13:00 -0000 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: Jiong Wang , Richard Biener CC: "christophe.lyon@linaro.org" , "gcc-patches@gcc.gnu.org" Subject: Re: [shrink-wrap] should not sink instructions which may cause trap ? References: <54257C11.9070109@arm.com> <54257D2A.1070103@arm.com> In-Reply-To: <54257D2A.1070103@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg02412.txt.bz2 On 09/26/14 08:50, Jiong Wang wrote: >>>> >>>> if (may_trap_p (x)) >>>> don't sink this instruction. >>>> >>>> any comments? >>> Should be checking if x may throw internally instead. >> Richard, thanks for the suggestion, have used insn_could_throw_p to do >> the check, >> which will only do the check when flag_exception and >> flag_non_call_exception be true, >> so those instruction could still be sink for normal c/c++ program. >> >> Jeff, >> >> below is the fix for pr49847.C regression on aarch64. I re-run >> full test on >> aarch64-none-elf bare metal, no regression. >> >> bootstrap ok on x86, no regression on check-gcc/g++. >> >> ok for trunk? > > (re-sent with changelog entry) > > gcc/ > > 2014-09-26 Jiong Wang > > * shrink-wrap.c (move_insn_for_shrink_wrap): Check > "insn_could_throw_p" before > sinking insn. I think can_throw_internal, per Richi's recommendation is better. Note that can_throw_internal keys off the existence of the EH landing pads for the particular insn. If flag_exceptions is false (for example), then would not expect those landing pads to exist and the insn would not be considered as potentially throwing. Can you test with can_throw_internal to verify it's behaviour and resubmit jeff