[Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure

2022-03-12 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96787

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|10.2|11.0

[Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure

2020-08-25 Thread acsawdey at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96787

--- Comment #1 from acsawdey at gcc dot gnu.org ---
Created attachment 49123
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49123&action=edit
hashtab.c with target power9 attribute on htab_delete()

[Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure

2020-08-25 Thread acsawdey at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96787

--- Comment #2 from acsawdey at gcc dot gnu.org ---
I'm seeing some load-past-store code motion that happens when compiling for
power10 vs power9 that makes me suspicious.

[Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure

2020-08-25 Thread acsawdey at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96787

--- Comment #3 from acsawdey at gcc dot gnu.org ---
Never mind that, all I'm seeing is the lack of save/restore of r2 in the
power10 version.

[Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure

2020-08-25 Thread dje at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96787

David Edelsohn  changed:

   What|Removed |Added

   Last reconfirmed||2020-08-26
   Target Milestone|--- |10.2
 CC||bergner at gcc dot gnu.org
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #4 from David Edelsohn  ---
Confirmed.

[Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure

2020-08-25 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96787

--- Comment #5 from Bill Schmidt  ---
The divergence occurs after .L75 in the two versions.  In the P10 version, we
see that the second bctrl has been converted into a bctr.  It looks like a tail
call optimization happening, but we aren't at the end of the function.  This
happens again later for the second bctrl after .L78.

Why would we think a tail call optimization can happen in the middle of a
block...

[Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure

2020-08-25 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96787

Bill Schmidt  changed:

   What|Removed |Added

 CC||amodra at gcc dot gnu.org

--- Comment #6 from Bill Schmidt  ---
Ah, I can't read.  These really are at the end(s) of the function, so it does
appear to be a tail call optimization that we've decided is legitimate.

It looks like the problem is that we don't set up r12 prior to the tail call. 
Unlike the usual case, here we have "mtctr 9" to set up the CTR and r12 still
points to the previously called function.  That can't be good.

This is exposed by my recent patch to allow more tail calls in
rs6000_decl_ok_for_sibcall, but it's not clear to me where we need to fix
things up so that r12 gets set.

[Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure

2020-08-25 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96787

--- Comment #7 from Bill Schmidt  ---
I believe the problem may be that rs6000_sibcall_aix doesn't contain any
handling for indirect calls, whereas similar code for other ABIs, like
rs6000_sibcall_sysv, does.  Alan, does this make sense?

[Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure

2020-08-26 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96787

--- Comment #8 from Bill Schmidt  ---
I'm working on a patch.

[Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure

2020-08-27 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96787

--- Comment #9 from CVS Commits  ---
The master branch has been updated by William Schmidt :

https://gcc.gnu.org/g:abca87c57847cd04f5e05935ff9ae5121c1ecb1d

commit r11-2908-gabca87c57847cd04f5e05935ff9ae5121c1ecb1d
Author: Bill Schmidt 
Date:   Thu Aug 27 11:17:06 2020 -0500

rs6000: Support ELFv2 sibcall for indirect calls [PR96787]

Prior to P10, ELFv2 hasn't implemented nonlocal sibcalls.  Now that we do,
we need to be sure that r12 is set up prior to such a call.

2020-08-27  Bill Schmidt  

gcc/
PR target/96787
* config/rs6000/rs6000.c (rs6000_sibcall_aix): Support
indirect call for ELFv2.

gcc/testsuite/

PR target/96787
* gcc.target/powerpc/pr96787-1.c: New.
* gcc.target/powerpc/pr96787-2.c: New.

[Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure

2020-08-27 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96787

Bill Schmidt  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Bill Schmidt  ---
Work is complete.