From patchwork Tue Apr 15 01:59:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Ye X-Patchwork-Id: 28374 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f69.google.com (mail-qg0-f69.google.com [209.85.192.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 03BF52036A for ; Tue, 15 Apr 2014 02:00:03 +0000 (UTC) Received: by mail-qg0-f69.google.com with SMTP id a108sf19658531qge.0 for ; Mon, 14 Apr 2014 19:00:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:from:to:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:content-type :content-transfer-encoding; bh=EKdb10jFMzhw1zIRcCwgKSseL/X7v2B4CyLXez6RA8E=; b=OCYyuc0QGN3ljJXWMTU3h8zTM6mKBN3hBjlLVAQRsNcw+q64ao235USlk7oySVBUaP rzfCDMB64tk3hZppNw7qFO0TABD+Ux6Zz+wn9FBBMsqNTmaRH4Gz9DUDBDCubO70NNGU CRCmM2dtsxmHGUp0d/QKwjNO9dZyhQlpY8XUqNVE0KxuvmQz5tuF/RgHoey4TsIGGc7v 7JgJvf9SYUdrYg8UbHYED0Xt4+V9YYJaUQ0E19vAynUZmQ4PX7lNEUeSnRUmHv0WYPvP 1ZjXnX7Kj0ODU+50NAAKYX2JWtEVHEW27MouRq5l2HqA6/cQGQbnQnZK/Zn+TkP+oYsN S6zg== X-Gm-Message-State: ALoCoQl7MxXyNyFK406NlMQEKW6kkp4Dle6vlecgs/8CN/A3ts8ktHSmTcXXOdV8H1Hj+D6tatEm X-Received: by 10.236.216.39 with SMTP id f37mr3688870yhp.57.1397527203752; Mon, 14 Apr 2014 19:00:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.20 with SMTP id b20ls2892406qga.5.gmail; Mon, 14 Apr 2014 19:00:03 -0700 (PDT) X-Received: by 10.52.15.132 with SMTP id x4mr4045818vdc.31.1397527203687; Mon, 14 Apr 2014 19:00:03 -0700 (PDT) Received: from mail-ve0-x235.google.com (mail-ve0-x235.google.com [2607:f8b0:400c:c01::235]) by mx.google.com with ESMTPS id eb17si3108711veb.76.2014.04.14.19.00.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Apr 2014 19:00:03 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::235 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::235; Received: by mail-ve0-f181.google.com with SMTP id oy12so8247067veb.26 for ; Mon, 14 Apr 2014 19:00:03 -0700 (PDT) X-Received: by 10.221.58.144 with SMTP id wk16mr5503583vcb.23.1397527203524; Mon, 14 Apr 2014 19:00:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp193490vcb; Mon, 14 Apr 2014 19:00:03 -0700 (PDT) X-Received: by 10.68.166.36 with SMTP id zd4mr3235751pbb.54.1397527202836; Mon, 14 Apr 2014 19:00:02 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id py5si3757214pbc.13.2014.04.14.19.00.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Apr 2014 19:00:02 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-365024-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 31821 invoked by alias); 15 Apr 2014 01:59:49 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 31589 invoked by uid 89); 15 Apr 2014 01:59:45 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Apr 2014 01:59:43 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Tue, 15 Apr 2014 02:59:41 +0100 Received: from SHAWIN205 ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 15 Apr 2014 02:59:55 +0100 From: "Joey Ye" To: Subject: [patch] Disable if_conversion2 for Og Date: Tue, 15 Apr 2014 09:59:52 +0800 Message-ID: <000001cf584e$66102060$32306120$@arm.com> MIME-Version: 1.0 X-MC-Unique: 114041502594100201 X-Original-Sender: joey.ye@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::235 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 If-converstion is harmful to optimized debugging as it generates conditional execution instructions with line number information, which resulted in a dillusion to developers that both then-else branches are executed. For example: test.c: 1: unsigned oldest_sequence; 2: 3: unsigned foo(unsigned seq_number) 4: { 5: if ((seq_number + 5) < 10) 6: seq_number += 100; 7: else 8: seq_number = oldest_sequence; if (seq_number < oldest_sequence) seq_number = oldest_sequence; return seq_number; } $ arm-none-eabi-gcc -mthumb -mcpu=cortex-m3 -Og -g3 gets: .loc 1 5 0 adds r3, r0, #5 cmp r3, #9 .loc 1 6 0 <----- line 6, then branch itee ls addls r0, r0, #100 .LVL1: .loc 1 8 0 <----- line 8, else branch. Both branches seems to be executed in GDB ldrhi r3, .L5 ldrhi r0, [r3] The reason is that if_conversion2 is still enabled in Og. The patch simply disables it for Og. Tests: * -Og bootstrap passed. * Make check default (no additional option): No regression. * Make check with -Og: expected regressions. Cases relying on if-conversion2 failed. > FAIL: gcc.target/arm/its.c scan-assembler-times \\tit 2 > FAIL: gcc.target/arm/pr40956.c scan-assembler-times mov[\\\\t ]*r., #0 1 > FAIL: gcc.target/arm/thumb-ifcvt-2.c scan-assembler asreq > FAIL: gcc.target/arm/thumb-ifcvt-2.c scan-assembler lslne > FAIL: gcc.target/arm/thumb-ifcvt.c scan-assembler asrne > FAIL: gcc.target/arm/thumb-ifcvt.c scan-assembler lslne OK to trunk and 4.8/4.9 branch? ChangeLog: * opts.c (OPT_fif_conversion2): Disable for Og. { OPT_LEVELS_1_PLUS, OPT_fipa_profile, NULL, 1 }, diff --git a/gcc/opts.c b/gcc/opts.c index fdc903f..e076253 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -432,7 +432,7 @@ static const struct default_options default_options_table[] = { OPT_LEVELS_1_PLUS, OPT_fcprop_registers, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fforward_propagate, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fif_conversion, NULL, 1 }, - { OPT_LEVELS_1_PLUS, OPT_fif_conversion2, NULL, 1 }, + { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fif_conversion2, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fipa_pure_const, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fipa_reference, NULL, 1 },