Re: [PATCH] adjust object size computation for union accesses and PHIs (PR 92765)

2020-02-06 Thread Jeff Law
On Wed, 2020-02-05 at 16:57 -0700, Martin Sebor wrote: > > It passes thanks to the TREE_CODE (arg) == PARM_DECL test added > in the patch to get_range_strlen (the test was missing before > and so while it handled ordinary objects (local or global) it > unnecessarily excluded function arguments. Oh

Re: [PATCH] adjust object size computation for union accesses and PHIs (PR 92765)

2020-02-05 Thread Martin Sebor
On 2/4/20 7:35 AM, Richard Biener wrote: ... Jakub/Richi, comments on this hunk? + tree ref = TREE_OPERAND (TREE_OPERAND (arg, 0), 0); + tree off = TREE_OPERAND (arg, 1); + if ((TREE_CODE (ref) == PARM_DECL || VAR_P (ref)) + && (!DECL_EXTERNAL (ref) +

Re: [PATCH] adjust object size computation for union accesses and PHIs (PR 92765)

2020-02-05 Thread Martin Sebor
On 2/3/20 11:44 AM, Jeff Law wrote: On Fri, 2020-01-31 at 12:04 -0700, Martin Sebor wrote: Attached is a reworked patch since the first one didn't go far enough to solve the major problems. The new solution relies on get_range_strlen_dynamic the same way as the sprintf optimization, and does aw

Re: [PATCH] adjust object size computation for union accesses and PHIs (PR 92765)

2020-02-04 Thread Richard Biener
On Mon, Feb 3, 2020 at 7:45 PM Jeff Law wrote: > > On Fri, 2020-01-31 at 12:04 -0700, Martin Sebor wrote: > > Attached is a reworked patch since the first one didn't go far > > enough to solve the major problems. The new solution relies on > > get_range_strlen_dynamic the same way as the sprintf

Re: [PATCH] adjust object size computation for union accesses and PHIs (PR 92765)

2020-02-03 Thread Jeff Law
On Fri, 2020-01-31 at 12:04 -0700, Martin Sebor wrote: > Attached is a reworked patch since the first one didn't go far > enough to solve the major problems. The new solution relies on > get_range_strlen_dynamic the same way as the sprintf optimization, > and does away with the determine_min_objsi

Re: [PATCH] adjust object size computation for union accesses and PHIs (PR 92765)

2020-01-31 Thread Martin Sebor
Attached is a reworked patch since the first one didn't go far enough to solve the major problems. The new solution relies on get_range_strlen_dynamic the same way as the sprintf optimization, and does away with the determine_min_objsize function and calling compute_builtin_object_size. To minim

Re: [PATCH] adjust object size computation for union accesses and PHIs (PR 92765)

2020-01-16 Thread Jakub Jelinek
On Wed, Jan 15, 2020 at 09:52:57PM +0100, Jakub Jelinek wrote: > This looks wrong. For one, this function is used for two purposes now and > you tweak it for one, but more importantly, whether he initial stmt > you see is a PHI or not can't make a difference, how is that case e.g. > different from

Re: [PATCH] adjust object size computation for union accesses and PHIs (PR 92765)

2020-01-15 Thread Jakub Jelinek
On Wed, Jan 15, 2020 at 01:18:54PM +, Martin Sebor wrote: > @@ -4099,14 +4122,18 @@ determine_min_objsize (tree dest) > >init_object_sizes (); > > - if (compute_builtin_object_size (dest, 2, &size)) > -return size; > - >/* Try to determine the size of the object through the RHS

Re: [PATCH] adjust object size computation for union accesses and PHIs (PR 92765)

2020-01-15 Thread Jeff Law
On Wed, 2020-01-15 at 13:18 +, Martin Sebor wrote: > The strcmp optimization newly introduced in GCC 10 relies on > the size of the smallest referenced array object to determine > whether the function can return zero. When the size of > the object is smaller than the length of the other string

[PATCH] adjust object size computation for union accesses and PHIs (PR 92765)

2020-01-15 Thread Martin Sebor
The strcmp optimization newly introduced in GCC 10 relies on the size of the smallest referenced array object to determine whether the function can return zero. When the size of the object is smaller than the length of the other string argument the optimization folds the equality to false. The b