From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id 3C9713858D34 for ; Fri, 5 Apr 2024 19:47:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3C9713858D34 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kam.mff.cuni.cz ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3C9713858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.113.20.16 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712346479; cv=none; b=pNcERHQwm3QPiGUGHtPuJsWWaxerh7fM+dfadx6Lxk2mVlquU6mpLFcwz/Eq/wA4Yc+I2CpkyyO0robTxYJjkyVn+YRaaTXz6y4HMKOx8lKugCJSVvxs8FBXU2PfeMmJlUqkM5fhMP/N+g9Hh4yDZRssBgUq1GrTfE62ETQ8YpQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712346479; c=relaxed/simple; bh=hwN8BSkIyounlx4sJsdVebXk+G57MDG5UhBxaXN2KkY=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=V/Ho5a5hiU/TYZ+ImxWIDS2Va7txBgPiSGUdJIIpY+ez2qzITpg+DEaQH8a8rMshTTbnuFV0RBGauLbzkkbvo9N48zS95xNOeZWGbfRqI46stfzWg+HsR18E8CuAyM/djT1Jvdq0rchGEwchGPrTFkjyHZ12BfQ05cXA/dYcv3A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 076AE2861C4; Fri, 5 Apr 2024 21:47:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1712346476; h=from:from:reply-to:subject:subject: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=ETczhO5yCg0MZp/v+5RXrY82HG/prtCjEI/h9ogfsX0=; b=rDnzZsqi6EwIOULVZkMbmVD7o7Ul1V6Q8eN5gStaofrCToJXPPxz0RYmlUXPv4n0VZ+sAP SUWYihHPqc5v93TpiXnTl8U/W9IrAjm7caRXnfvzcWH5SzQv0cRwiY26TWDmhn3i8mPUFw yObv/Z08ebsav6f1vfD+wjptGJnlfik= Date: Fri, 5 Apr 2024 21:47:55 +0200 From: Jan Hubicka To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH 3/3] tree-optimization/114052 - niter analysis from undefined behavior Message-ID: References: <20240405131334.85979139F1@imap2.dmz-prg2.suse.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240405131334.85979139F1@imap2.dmz-prg2.suse.org> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,JMQ_SPF_NEUTRAL,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > + /* 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. 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