public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/95786] New: Too aggressive target indirection elimination
@ 2020-06-20 16:28 yyc1992 at gmail dot com
  2020-06-22  8:07 ` [Bug ipa/95786] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: yyc1992 at gmail dot com @ 2020-06-20 16:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95786
           Summary: Too aggressive target indirection elimination
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yyc1992 at gmail dot com
  Target Milestone: ---

I realize this issue when debugging PR95778 and PR95780 (ref
https://gcc.gnu.org/pipermail/gcc-patches/2020-June/548631.html)

It seems that the indirection elimination logic does not take into account the
linkage and visibility of the callee and will eliminate the indirection even in
cases where a function without target attribute would have use a PLT and, for
example, allows a override from a different library.

The following code generates a direct call beween g2 and f2 without going
through PLT.

```
__attribute__((target_clones("default,avx2"))) int f2(int *p)
{
    asm volatile ("" :: "r"(p) : "memory");
    return *p;
}

__attribute__((target_clones("default,avx2"))) int g2(int *p)
{
    return f2(p);
}
```

but removing the target_clones attribute uses the PLT.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug ipa/95786] Too aggressive target indirection elimination
  2020-06-20 16:28 [Bug tree-optimization/95786] New: Too aggressive target indirection elimination yyc1992 at gmail dot com
@ 2020-06-22  8:07 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-06-22  8:07 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
          Component|tree-optimization           |ipa
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I guess bypassing the dispatcher is also not OK here.  Maybe the initial
cgraph looks semantically wrong already.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-22  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-20 16:28 [Bug tree-optimization/95786] New: Too aggressive target indirection elimination yyc1992 at gmail dot com
2020-06-22  8:07 ` [Bug ipa/95786] " rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).