This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA][PATCH][tree-optimization/78496] 01/03 Do not lose range information from earlier VRP passes
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 4 Dec 2017 09:11:58 +0100
- Subject: Re: [RFA][PATCH][tree-optimization/78496] 01/03 Do not lose range information from earlier VRP passes
- Authentication-results: sourceware.org; auth=none
- References: <b1a2833c-5f5b-fa70-3813-c152daa73552@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Sun, Dec 03, 2017 at 10:55:27PM -0700, Jeff Law wrote:
> As we touched on in IRC, the EVRP analyzer was doing something stupid
> which caused it to not merge in existing range information under certain
> circumstances.
>
> Consider this fragment:
>
> x_1 = foo ()
> if (x_1 > 2)
> __builtin_unreachable ();
> if (x_1 < 0)
> __builtin_unreachable ();
Note that for say:
x_1 = foo ();
bar (x_1);
if (x_1 > 2)
__builtin_unreachable ();
if (x_1 < 0)
__builtin_unreachable ();
...
further uses of x_1
we can't do that anymore (at least, can't remember it in
SSA_NAME_RANGE_INFO), as bar could not return/could loop etc. Ditto with
any other code in between foo and the unreachable asserts if it doesn't
guarantee that we'll always reach the comparisons after the x_1 setter.
Even
x_1 = foo ();
bar ();
if (x_1 > 2)
__builtin_unreachable ();
if (x_1 < 0)
__builtin_unreachable ();
looks unclean, if bar doesn't return, then we'd just need to hope we don't
add further uses of x_1 in between foo and bar. Some optimizations do stuff
like that, consider foo being a pass-through function.
Jakub