Re: [PATCH v5 1/4] tree-object-size: Support dynamic sizes in conditions

2022-01-10 Thread Siddhesh Poyarekar
On 10/01/2022 16:07, Jakub Jelinek wrote: You test the above with both possibilities. + if (test_builtin_calloc_condphi (128, 1, 0) == 128) +FAIL (); But not this one, why? Also, it would be better to have a != ... test rather than ==, if it is the VLA, then 128 * sizeof (struct { int

Re: [PATCH v5 1/4] tree-object-size: Support dynamic sizes in conditions

2022-01-10 Thread Jakub Jelinek via Gcc-patches
On Sat, Dec 18, 2021 at 06:05:08PM +0530, Siddhesh Poyarekar wrote: Sorry for the delay. > +size_t > +__attribute__ ((noinline)) > +test_builtin_calloc_condphi (size_t cnt, size_t sz, int cond) > +{ > + struct > +{ > + int a; > + char b; > +} bin[cnt]; > + > + char *ch =

[PATCH v5 1/4] tree-object-size: Support dynamic sizes in conditions

2021-12-18 Thread Siddhesh Poyarekar
Handle GIMPLE_PHI and conditionals specially for dynamic objects, returning PHI/conditional expressions instead of just a MIN/MAX estimate. This makes the returned object size variable for loops and conditionals, so tests need to be adjusted to look for precise size in some cases.