From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4A6C03858031; Fri, 23 Jun 2023 15:37:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A6C03858031 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687534650; bh=ODm3McI2nxtP/DP39wPqAHuvEmtd7i9gsypOMCSAiSU=; h=From:To:Subject:Date:From; b=EDjJ/tIlyEDzJqy1ygSNFHp9RBkv0ARnxdPtPOqD2rVJYNZcolfFr1QeOw2xMmCDI qRla68ycnQztXMvYg71cVdiT0tBL+B2Tq5DE7xCTgx6Mqf/a6jwH4/OfY2eyfw7Eun x0YHzuuU7iicigcZwwDdP6zfO0nXiaTcSF01R+5M= From: "hubicka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/110377] New: Early VRP and IPA-PROP should work out value ranges from __builtin_unreacahble Date: Fri, 23 Jun 2023 15:37:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110377 Bug ID: 110377 Summary: Early VRP and IPA-PROP should work out value ranges from __builtin_unreacahble Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: hubicka at gcc dot gnu.org Target Milestone: --- In the following testcase void test2(int); void test(int n) { if (n > 5) __builtin_unreachable (); test2(n); } we should work out that value range of n passed to test2 is [INT_MIN,4]. This would help optimizing some code in libstdc++, which now uses similar constructs to ensure known value ranges. I think it is a common case where such unreachable test can be retrofited to the SSA_NAME based on the fact that program can not terminate between definition and the conditional. We currently get: function test/0 parameter descriptors: param #0 n used undescribed_use Jump functions of caller test/0: callsite test/0 -> test2/2 :=20 param 0: PASS THROUGH: 0, op nop_expr value: 0x0, mask: 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff= fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff Unknown VR callsite test/0 -> __builtin_unreachable/1 :=