[Bug tree-optimization/92867] New: Use ERF_RETURNS_ARG in more places

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 9 11:10:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92867

            Bug ID: 92867
           Summary: Use ERF_RETURNS_ARG in more places
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Shouldn't we use the fact that some functions returns one of its arguments
unmodified in more places?

E.g. for tail calls:
char buf[128] = { 1 };                                                          

char *                                                                          
foo (int n)                                                                     
{                                                                               
  return __builtin_memset (buf, ' ', n);                                        
}                                                                               

char *                                                                          
bar (int n)                                                                     
{                                                                               
  __builtin_memset (buf, ' ', n);                                               
  return buf;                                                                   
}                                                                               

we get better code (tail call) just in the first case and not the second one.

Shouldn't we perform IPA discovery of calls that return one of their arguments?

And, shouldn't we have some user attribute which would allow to specify this?


More information about the Gcc-bugs mailing list