From patchwork Fri May 3 14:00:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 241313 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id E06852C00D3 for ; Sat, 4 May 2013 00:00:38 +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 :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=BHw+MeYlllX4tpNLxgBWbf20qsxEIm7HFJOYVC5pCiv xzJj8cVAz7B2JZPHuN1i1SHbWnRCUNvvn8pV+GjdKQoX2/uz43458cQEvrKTLn8P VPkT0r8H9E2RSO3Tz+GIevXqwR1hW5FbtH4SAFa6/ca47aKfFudZ2JVnqM0krcXA = 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 :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=G4UAhC8WayiUPVe/ofuQkwkTJD8=; b=FHD+0yuUNtDKF1Tg0 lRuD1NdVH2W+TgEzvdX8PjOcDFS/7GechLNuYAnXTInz5SRyqkclz3Hkqg4VvRmk NCpQSiEUE/oY1JjI5hMgMuPnyxU19JzyYc/4UYM/NyJWg9fwGOcaEJZMwD5QT6g/ 0dpm4rDERw3fNpiUlVUBPX6GKY= Received: (qmail 22219 invoked by alias); 3 May 2013 14:00:32 -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 22208 invoked by uid 89); 3 May 2013 14:00:31 -0000 X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS, TW_ZJ autolearn=ham version=3.3.1 Received: from mail-oa0-f50.google.com (HELO mail-oa0-f50.google.com) (209.85.219.50) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 03 May 2013 14:00:30 +0000 Received: by mail-oa0-f50.google.com with SMTP id vp8so1626535oab.23 for ; Fri, 03 May 2013 07:00:29 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.149.129 with SMTP id ua1mr3078370oeb.56.1367589629147; Fri, 03 May 2013 07:00:29 -0700 (PDT) Received: by 10.182.156.49 with HTTP; Fri, 3 May 2013 07:00:29 -0700 (PDT) Date: Fri, 3 May 2013 16:00:29 +0200 Message-ID: Subject: [PATCH, i386]: Fix PR 57106, -fcompare-debug failure with -O2 -fschedule-insns -funroll-all-loops From: Uros Bizjak To: "gcc-patches@gcc.gnu.org" Cc: Yuri Rumyantsev , Igor Zamyatin X-Virus-Found: No Hello! Apparently, the wrong insn is used when adding insn dependencies. The "last" index gets updated to the found !NONDEBUG_INSN. Use "first_arg" that points to the right insn instead. 2013-05-03 Uros Bizjak PR target/57106 * config/i386/i386.c (add_parameter_dependencies): Add dependence between "first_arg" and "insn", not "last" and "insn". testsuite/ChangeLog: 2013-05-03 Uros Bizjak * gcc.target/i386/pr57106.c: New test. Tested on x86_64-pc-linux-gnu {,-m32}. I will wait for Intel guys to check this patch with -fschedule-insns on their codes. Uros. Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 198577) +++ config/i386/i386.c (working copy) @@ -24662,7 +24662,7 @@ add_parameter_dependencies (rtx call, rtx head) /* Add output depdendence between two function arguments if chain of output arguments contains likely spilled HW registers. */ if (is_spilled) - add_dependence (last, insn, REG_DEP_OUTPUT); + add_dependence (first_arg, insn, REG_DEP_OUTPUT); first_arg = last = insn; } else @@ -41355,7 +41355,8 @@ ix86_enum_va_list (int idx, const char **pname, tr #undef TARGET_SCHED_ADJUST_PRIORITY #define TARGET_SCHED_ADJUST_PRIORITY ix86_adjust_priority #undef TARGET_SCHED_DEPENDENCIES_EVALUATION_HOOK -#define TARGET_SCHED_DEPENDENCIES_EVALUATION_HOOK ix86_dependencies_evaluation_hook +#define TARGET_SCHED_DEPENDENCIES_EVALUATION_HOOK \ + ix86_dependencies_evaluation_hook /* The size of the dispatch window is the total number of bytes of object code allowed in a window. */ Index: testsuite/gcc.target/i386/pr57106.c =================================================================== --- testsuite/gcc.target/i386/pr57106.c (revision 0) +++ testsuite/gcc.target/i386/pr57106.c (working copy) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fschedule-insns -funroll-all-loops -fcompare-debug" } */ + +typedef void block128_f (int *, int); + +void +foo (int *out, int *iv, block128_f block) +{ + while (1) + { + *out = *out ^ *iv; + block (out, *out); + iv = out; + } +}