From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 4CDA5393C876 for ; Fri, 11 Jun 2021 07:29:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4CDA5393C876 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 5B94A1FD2F for ; Fri, 11 Jun 2021 07:29:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1623396566; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=SQ1ti2pZn+1InLpcywg8ycVe0IwDJsxo7B4c2ZTMywc=; b=YKrO+BfTQCaPGGS81Dg9ZMXOQSwtZFhjh7p85eB+Rr/s7jB0Y28ChZpsoyrfSz5k+CErEo QMSx08jo+rffkRPXbu5iNo3ncWxerTWgjNLmbaYWWpoxitxNegrcoivcKjFugafPNDB0ea GE2IakytawjkHM9WUPlycu7FNgRshH0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1623396566; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=SQ1ti2pZn+1InLpcywg8ycVe0IwDJsxo7B4c2ZTMywc=; b=M5d5PGupb7Njop4Yrpv9PMkktMxc5goj8qPvE0WillvptCmdRkDe0zTxXPnVXaIw/KV1v8 /kykoTFSziVhZ3Dw== Received: from [10.163.28.26] (unknown [10.163.28.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 4D0EEA3B84 for ; Fri, 11 Jun 2021 07:29:26 +0000 (UTC) Date: Fri, 11 Jun 2021 09:29:26 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Use stablesort for sorting association chain Message-ID: <563p8171-436p-73rp-9p2s-po42o270794@fhfr.qr> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jun 2021 07:29:28 -0000 This should preserve the original association order as much as possible for the initial SLP discovery attempt and also improve consistency. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. 2021-06-11 Richard Biener * tree-vect-slp.c (vect_build_slp_tree_2): Use stablesort to sort operands of the associative chain. --- gcc/tree-vect-slp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index c4f8f38012f..6237a61ffd4 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1865,7 +1865,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node, /* Now we have a set of chains with the same length. */ /* 1. pre-sort according to def_type and operation. */ for (unsigned lane = 0; lane < group_size; ++lane) - chains[lane].sort (dt_sort_cmp, vinfo); + chains[lane].stablesort (dt_sort_cmp, vinfo); if (dump_enabled_p ()) { dump_printf_loc (MSG_NOTE, vect_location, -- 2.26.2