From patchwork Sat Jul 15 20:47:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Monakov X-Patchwork-Id: 788979 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 3x91t61XlNz9s75 for ; Sun, 16 Jul 2017 06:50:53 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ukpqZ5RE"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=qjoGmO9DBRZZmLELvdCizheiXjI18ZE3lerV3P37G8NkH35RfURu7 vREoW8RBwDEEz8J+Cm53WccHSZKBGcC7deaf2e8D0zDPmNmS+/m2m4BCbTAVK0fg HrnAtjVELh7HriLaYluXi8S72Vs/Ud0gKWFuYjmTbCBqcgylTsZFH8= 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:from :to:subject:date:message-id:in-reply-to:references; s=default; bh=9j7ZagLNGy62ZJYrD9NOujABrN0=; b=ukpqZ5RE7SSNKMiysv1Iekd/wUVy 1aU2kUmpKCzmO0ZquU4m5Znol7Kuou1bLRb3OXNNrAwodInW82s8V0H9EXt/YNGs lD/UaENKKy40jrtBq2dT/Ld9lcSKICWkAdi9sLp9LyDNhHZLp2c1UJbW5ILOKSNo v4vfQMnUFDDvZSg= Received: (qmail 28701 invoked by alias); 15 Jul 2017 20:49:04 -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 119528 invoked by uid 89); 15 Jul 2017 20:48:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=rac, Hx-languages-length:1731 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 15 Jul 2017 20:48:29 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dWTzC-0004BB-SG for gcc-patches@gcc.gnu.org; Sat, 15 Jul 2017 16:48:27 -0400 Received: from bran.ispras.ru ([83.149.199.196]:38135 helo=smtp.ispras.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dWTzC-00048t-K3 for gcc-patches@gcc.gnu.org; Sat, 15 Jul 2017 16:48:22 -0400 Received: from monopod.intra.ispras.ru (monopod.intra.ispras.ru [10.10.3.121]) by smtp.ispras.ru (Postfix) with ESMTP id E8E3B60E77 for ; Sat, 15 Jul 2017 23:48:17 +0300 (MSK) From: Alexander Monakov To: gcc-patches@gcc.gnu.org Subject: [PATCH 4/6] lra-assigns.c: give up on qsort checking in assign_by_spills Date: Sat, 15 Jul 2017 23:47:47 +0300 Message-Id: <20170715204749.24398-5-amonakov@ispras.ru> In-Reply-To: <20170715204749.24398-1-amonakov@ispras.ru> References: <20170715204749.24398-1-amonakov@ispras.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 83.149.199.196 The reload_pseudo_compare_func comparator, when used from assign_by_spills, can be non-transitive, indicating A < B < C < A if both A and C satisfy !bitmap_bit_p (&non_reload_pseudos, rAC), but B does not. This function was originally a proper comparator, and the problematic clause was added to fix PR 57878: https://gcc.gnu.org/ml/gcc-patches/2013-07/msg00732.html That the comparator is invalid implies that that PR, if it still exists, can reappear (but probably under more complicated circumstances). This looks like a sensitive area, so disabling checking is the only obvious approach. * lra-assigns.c (reload_pseudo_compare_func): Add a FIXME. (assign_by_spills): Use non-checking qsort. --- gcc/lra-assigns.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c index 2aadeef..a67d1a6 100644 --- a/gcc/lra-assigns.c +++ b/gcc/lra-assigns.c @@ -217,6 +217,7 @@ reload_pseudo_compare_func (const void *v1p, const void *v2p) /* The code below executes rarely as nregs == 1 in most cases. So we should not worry about using faster data structures to check reload pseudos. */ + /* FIXME this makes comparator non-transitive and thus invalid. */ && ! bitmap_bit_p (&non_reload_pseudos, r1) && ! bitmap_bit_p (&non_reload_pseudos, r2)) return diff; @@ -1384,7 +1385,7 @@ assign_by_spills (void) bitmap_ior_into (&non_reload_pseudos, &lra_optional_reload_pseudos); for (iter = 0; iter <= 1; iter++) { - qsort (sorted_pseudos, n, sizeof (int), reload_pseudo_compare_func); + qsort_nochk (sorted_pseudos, n, sizeof (int), reload_pseudo_compare_func); nfails = 0; for (i = 0; i < n; i++) {