From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id A3F6A3858C54 for ; Wed, 26 Apr 2023 12:17:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A3F6A3858C54 Authentication-Results: sourceware.org; dmarc=pass (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-out1.suse.de (Postfix) with ESMTP id 9F23C21A11; Wed, 26 Apr 2023 12:17:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1682511425; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QiDY5KijkropYwa/z8PK8V2m0n4tTnTL639MLFZciKA=; b=LIOkge8n6eSffELmyFCTfu28q4WlPrzaHWbEMeOvkrO+/lumNMvS0egsbbYzZRH3HYSxKX rNhGVjMm3nirB8C0KJnro059IJmuU7n8L1N3jdDsV5Pqcp0V7sT4X1NHZMGAUuAyhv8Swt eAu96BrkyFNvHWdwb3zsnQHPS7b8Dvk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1682511425; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QiDY5KijkropYwa/z8PK8V2m0n4tTnTL639MLFZciKA=; b=QphgQgENjQsIQT+2KEIIoFs5EM/HTLVDhtI+3j8wRG5UNHLfCOfx07+g5Zp9Ndossf6iLZ 3lIci7XAk1uWqIAA== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (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 8BBDB2C141; Wed, 26 Apr 2023 12:17:05 +0000 (UTC) Date: Wed, 26 Apr 2023 12:17:05 +0000 (UTC) From: Richard Biener To: Jan Hubicka cc: Bernhard Reutner-Fischer , Jan Hubicka via Gcc-patches Subject: Re: Unloop no longer looping loops in loop-ch In-Reply-To: Message-ID: References: <116D73F6-1281-4378-9F26-E4A47DF46775@gmail.com> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, 26 Apr 2023, Jan Hubicka wrote: > > > - if (precise) > > > + if (precise > > > + && get_max_loop_iterations_int (loop) == 1) > > > + { > > > + if (dump_file && (dump_flags & TDF_DETAILS)) > > > + fprintf (dump_file, "Loop %d no longer loops.\n", loop->num); > > > > but max loop iterations is 1 ...? > > I first check for loops with 0 iterations, push them to unlooping list > and avoid any header copying (it is useless). > At this patch we already did header duplication and verified that the > maximal number of iterations will drop by 1 since there is no way loop > can terminate except for the header tests we peeled out. > > So 1 would turn to 0 in the loop info update and it seems useless to do > it. > > > > > + loops_to_unloop.safe_push (loop); > > > + loops_to_unloop_nunroll.safe_push (0); > > > + } > > > + else if (precise) > > > { > > > if (dump_file && (dump_flags & TDF_DETAILS)) > > > fprintf (dump_file, > > > @@ -688,6 +699,12 @@ ch_base::copy_headers (function *fun) > > > BITMAP_FREE (exit_bbs); > > > } > > > } > > > + if (loops_to_unloop.length()) > > > > !loops_to_unloop.is_empty () > I updated that in my copy of the patch. > > > > > + { > > > + bool irred_invalidated; > > > + unloop_loops (loops_to_unloop, loops_to_unloop_nunroll, NULL, &irred_invalidated); > > > + changed = true; > > > + } > > > free (bbs); > > > free (copied_bbs); > > > > > > Since we run VN on the header copies I wonder if, since you remove > > edges, we need to run CFG cleanup before this and updating SSA form? > > For safety we usually let CFG cleanup do the actual CFG manipulation > > and just change cond jumps to if (0) or if (1)? > > I do unlooping only after the VN so I think I am safe here. Ah OK. The patch is OK then. Thanks, Richard.