From patchwork Fri Jan 13 10:31:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramana Radhakrishnan X-Patchwork-Id: 6179 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2476323E01 for ; Fri, 13 Jan 2012 10:31:35 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 0EA26A182B6 for ; Fri, 13 Jan 2012 10:31:35 +0000 (UTC) Received: by bkbzu5 with SMTP id zu5so2681106bkb.11 for ; Fri, 13 Jan 2012 02:31:34 -0800 (PST) Received: by 10.204.41.143 with SMTP id o15mr68178bke.63.1326450694757; Fri, 13 Jan 2012 02:31:34 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs25949bkc; Fri, 13 Jan 2012 02:31:34 -0800 (PST) Received: by 10.182.226.6 with SMTP id ro6mr218194obc.3.1326450692744; Fri, 13 Jan 2012 02:31:32 -0800 (PST) Received: from mail-tul01m020-f178.google.com (mail-tul01m020-f178.google.com [209.85.214.178]) by mx.google.com with ESMTPS id ho6si1803813obb.52.2012.01.13.02.31.32 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 13 Jan 2012 02:31:32 -0800 (PST) Received-SPF: neutral (google.com: 209.85.214.178 is neither permitted nor denied by best guess record for domain of ramana.radhakrishnan@linaro.org) client-ip=209.85.214.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.214.178 is neither permitted nor denied by best guess record for domain of ramana.radhakrishnan@linaro.org) smtp.mail=ramana.radhakrishnan@linaro.org Received: by mail-tul01m020-f178.google.com with SMTP id tb2so2524514obb.37 for ; Fri, 13 Jan 2012 02:31:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.43.10 with SMTP id s10mr141481obl.43.1326450692079; Fri, 13 Jan 2012 02:31:32 -0800 (PST) Received: by 10.182.202.72 with HTTP; Fri, 13 Jan 2012 02:31:32 -0800 (PST) Date: Fri, 13 Jan 2012 10:31:32 +0000 Message-ID: Subject: [RFC combine] PR48308 - Fix issue with missing(?) LOG_LINKS From: Ramana Radhakrishnan To: gcc-patches Cc: Patch Tracking Hi, PR48308 is a case where on the ARM port we incorrectly delete a call to strcmp assuming that this is dead. However the problem starts early enough in combine where when try_combine is given i2 of the form (parallel [(set (reg:CC X) (compare:CC OP (const_int 0))) (set Y OP)]) and i1 is NULL it transforms this to : (set Y OP) and change I2 to be (set (reg:CC X) (compare:CC Y (const_int 0))) but in the snippet of code that changes i1 and i2 we don't seem to update LOG_LINKS . We then go and check if i1_feeds_into_i2 and that check relies on the LOG_LINKS being up-to-date. We find that i2 can be combined with i3 *but* we've then gone and made a transformation that results in Y being used but miss out emitting the set of Y. The attached patch appears to fix the problem for the reduced testcase and reduced^2 testcase attached to PR48308. Unfortunately this doesn't fix the testcase from PR50313 which prima-facie was a dup of this bug which I'm still investigating. This has survived bootstrap on x86_64 and is running tests there ( though based on a quick reading of the x86 backend I couldn't find any parallels of that form) and is still undergoing a full bootstrap run on an ARM board. Thoughts ? cheers Ramana #endif diff --git a/gcc/combine.c b/gcc/combine.c index 4178870..f6b8769 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2865,6 +2865,8 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p, SUBST (PATTERN (i2), XVECEXP (PATTERN (i2), 0, 0)); SUBST (XEXP (SET_SRC (PATTERN (i2)), 0), SET_DEST (PATTERN (i1))); + LOG_LINKS (i2) = alloc_insn_link (i1, LOG_LINKS (i2)); + } }