On 12/14/22 14:22, Jan Hubicka via Gcc-patches wrote:
>>>     PR middle-end/105818
>>>
>>> gcc/ChangeLog:
>>>
>>>     * predict.cc (optimize_function_for_size_p): Further check
>>>     optimize_size of fun->decl when it is valid but no cgraph node.
>>>
>>> gcc/testsuite/ChangeLog:
>>>
>>>     * gcc.target/powerpc/pr105818.c: New test.
>>>     * gcc.dg/guality/pr54693-2.c: Adjust for aarch64.
>>> diff --git a/gcc/testsuite/gcc.target/powerpc/pr105818.c 
>>> b/gcc/testsuite/gcc.target/powerpc/pr105818.c
>>> new file mode 100644
>>> index 00000000000..679647e189d
>>> --- /dev/null
>>> +++ b/gcc/testsuite/gcc.target/powerpc/pr105818.c
>>> @@ -0,0 +1,11 @@
>>> +/* { dg-options "-Os -fno-tree-vectorize" } */
>>> +
>>> +/* Verify there is no ICE.  */
>>> +
>>> +#pragma GCC optimize "-fno-tree-vectorize"
>>> +
>>> +void
>>> +foo (void)
>>> +{
>>> +  void bar (void);
>>> +}

Hi.

Next time, please CC me if you cite me.

> So the testcase starts with optimize_size set but then it switches to
> optimize_size==0 due to the GCC optimize pragma.  I think this is
> behaviour Martin wants to change, so perhaps the testcase should be
> written with explicit -O2.

No, the pragma does not modify optimize_size as "optimize" attribute behaves
as documented:

```
...
The optimize attribute arguments of a function behave behave as if appended to 
the command-line.
```

Martin

> 
> I also wonder what happen when you add the attribute later?
> /* { dg-options "-Os -fno-tree-vectorize" } */
> 
> /* Verify there is no ICE.  */
> 
> #pragma GCC optimize "-fno-tree-vectorize"
> 
> void
> foo (void)
> {
>   void bar (void);
> }
> 
> __attribute__ ((optimize("-fno-tree-vectorize"))) void foo (void);
> 
> I think we should generally avoid doing decisions about size/speed
> optimizations so early since the setting may change due to attribtes or
> profile feedback...
> 
> Honza

Reply via email to