This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] tree-optimization/71831 - __builtin_object_size poor results with no optimization


On Fri, Aug 19, 2016 at 04:30:47PM -0600, Martin Sebor wrote:
> The patch looks bigger than it actually is because:
> 
> 1) It modifies the return type of the function to bool rather than
>    unsigned HOST_WIDE_INT representing the object size (this was
>    necessary to avoid having its callers misinterpret zero as
>    unknown when it means zero bytes).

Can you explain why do you need this?  I don't understand why do you need to
differentiate between unknown and maximum (or minimum for modes 2 and 3 that
nobody actually uses in real-world), the builtin after all returns the same
value for both.  If you want to know if the compiler knows the size
precisely, you can request both mode 0 (or 1) and 2 (or 3) and compare, if
the values are the same, it is the exact size, if there is a range, then you
have minimum and maximum (and, if minimum is 0, but maximum non-zero, you
really don't know minimum, if maximum is -1, then you really don't know the
maximum (no object should be better that big).  For the return value, I
don't see how you could reliably differentiate between the two even if it
made for whatever strange reason sense - for SSA_NAMEs etc. you have just
recorded the sizes, not also a flag whether it is unknown or known.

> 2) As a result of a small change to the conditional that controls
>    the main algorithm of the compute_builtin_object_size function
>    it changes the depth of its indentation (without actually
>    changing any of the code there).

If you've done lots of redindentation, then additionally diff -upb would be
appreciated.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]