From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 88A243858410 for ; Mon, 8 Apr 2024 11:31:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 88A243858410 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 88A243858410 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712575867; cv=none; b=X7OzxQcAXRFhbDKBSkmVKo9uM3tfUGNIyM4KH5m3g+wkbMje3SQhHjJZ25n9qUpRbgZNsfeFTREjT2PHJcI4IM8myjalqf1+lgQE1SqFo+xplJ1/JF5Ox93KPfw4Xq7PqzF4np6ONZtWt1mJP2XFl/Q1Y3y0RFg/EHs70ppKv9g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712575867; c=relaxed/simple; bh=DuJp/YHpALOWC3YstaSEizltQk1DG9W1zgDWEr+H9gs=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:Message-ID:MIME-Version; b=scPR5IemsWAWx8dSPdU1B6JTVzUnlTuqgGabXFLz17zOmNj/SByXILltq+bDqAV6D8WDme5niets3T0yMal7ov9/18yuaxNVAY9eyVFPnLL+4WVLzFRPt03z4UaV1iXgWnwiock0BWo/pr1UfDQV3372MhgUzAgzWe0T8lVJf5o= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [10.168.5.241] (unknown [10.168.5.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 14E96202F2; Mon, 8 Apr 2024 11:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712575862; 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=JvU1cNWZqjlZ29HIszBR9WzcJZLcYMVlCTjkCrvIDE0=; b=HQ4xhLxBu2vFKY+/l9ohqGxvG0lTl7OCPqxLyzTTIa6kamhhiPQZ3S4nyY7Mu6/Sfc3tWd nKlnKmjdlHs17h62ZgMjrKLJtp8QjSJHDlJgbUuAayXirL6rgiJnxkhxrwIfH2qfkaTfMm BahDV3u9JqlM+PN02yxg5ElVd1FcEEk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712575862; 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=JvU1cNWZqjlZ29HIszBR9WzcJZLcYMVlCTjkCrvIDE0=; b=aXIBok1HsDg1JhNYr7lglgUJ1GitIpJYFDkQSknP7hK6FVmPlimI1WSNjEE++ZSF+WE9/q 253bBE374uPI9eBw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712575862; 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=JvU1cNWZqjlZ29HIszBR9WzcJZLcYMVlCTjkCrvIDE0=; b=HQ4xhLxBu2vFKY+/l9ohqGxvG0lTl7OCPqxLyzTTIa6kamhhiPQZ3S4nyY7Mu6/Sfc3tWd nKlnKmjdlHs17h62ZgMjrKLJtp8QjSJHDlJgbUuAayXirL6rgiJnxkhxrwIfH2qfkaTfMm BahDV3u9JqlM+PN02yxg5ElVd1FcEEk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712575862; 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=JvU1cNWZqjlZ29HIszBR9WzcJZLcYMVlCTjkCrvIDE0=; b=aXIBok1HsDg1JhNYr7lglgUJ1GitIpJYFDkQSknP7hK6FVmPlimI1WSNjEE++ZSF+WE9/q 253bBE374uPI9eBw== Date: Mon, 8 Apr 2024 13:31:01 +0200 (CEST) From: Richard Biener To: Jan Hubicka cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH 3/3] tree-optimization/114052 - niter analysis from undefined behavior In-Reply-To: Message-ID: References: <20240405131334.85979139F1@imap2.dmz-prg2.suse.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Score: -2.94 X-Spam-Level: X-Spamd-Result: default: False [-2.94 / 50.00]; BAYES_HAM(-1.64)[92.73%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_ZERO(0.00)[0]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; MISSING_XM_UA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email] X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP 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 Fri, 5 Apr 2024, Jan Hubicka wrote: > > + /* When there's a call that might not return the last iteration > > + is possibly partial. This matches what we check in invariant > > + motion. > > + ??? For the call argument evaluation it would be still OK. */ > > + if (!may_have_exited > > + && is_gimple_call (stmt) > > + && gimple_has_side_effects (stmt)) > > + may_have_exited = true; > > I think you are missing here non-call EH, volatile asms and traps. > We have stmt_may_terminate_function_p which tests there. That returns true for all variable array accesses, I think we want to catch traps explicitly here. I'm going to do if (!may_have_exited && (gimple_has_side_effects (stmt) || stmt_can_throw_external (cfun, stmt))) may_have_exited = true; that should cover all but the generic trapping and not use IPA info to prove no side-effects. Richard. > Honza > > + > > + infer_loop_bounds_from_array (loop, stmt, > > + reliable && !may_have_exited); > > > > - if (reliable) > > + if (reliable && !may_have_exited) > > { > > infer_loop_bounds_from_signedness (loop, stmt); > > infer_loop_bounds_from_pointer_arith (loop, stmt); > > } > > } > > - > > } > > } > > > > @@ -4832,7 +4855,7 @@ estimate_numbers_of_iterations (class loop *loop) > > diagnose those loops with -Waggressive-loop-optimizations. */ > > number_of_latch_executions (loop); > > > > - basic_block *body = get_loop_body (loop); > > + basic_block *body = get_loop_body_in_rpo (cfun, loop); > > auto_vec exits = get_loop_exit_edges (loop, body); > > likely_exit = single_likely_exit (loop, exits); > > FOR_EACH_VEC_ELT (exits, i, ex) > > -- > > 2.35.3 > -- Richard Biener SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)