public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/110377] New: Early VRP and IPA-PROP should work out value ranges from __builtin_unreacahble
@ 2023-06-23 15:37 hubicka at gcc dot gnu.org
  2023-06-26  8:56 ` [Bug middle-end/110377] Early VRP and IPA-PROP should work out value ranges from __builtin_unreachable rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: hubicka at gcc dot gnu.org @ 2023-06-23 15:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110377

            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 : 
       param 0: PASS THROUGH: 0, op nop_expr
         value: 0x0, mask:
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
         Unknown VR
    callsite  test/0 -> __builtin_unreachable/1 :

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-11-21 15:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-23 15:37 [Bug middle-end/110377] New: Early VRP and IPA-PROP should work out value ranges from __builtin_unreacahble hubicka at gcc dot gnu.org
2023-06-26  8:56 ` [Bug middle-end/110377] Early VRP and IPA-PROP should work out value ranges from __builtin_unreachable rguenth at gcc dot gnu.org
2023-06-26 14:20 ` amacleod at redhat dot com
2023-06-26 16:48 ` hubicka at gcc dot gnu.org
2023-06-26 19:49 ` amacleod at redhat dot com
2023-06-27  7:45 ` hubicka at gcc dot gnu.org
2023-06-28  7:35 ` cvs-commit at gcc dot gnu.org
2023-11-21 15:12 ` hubicka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).