public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/45256] Missed arithmetic simplification at tree level
       [not found] <bug-45256-4@http.gcc.gnu.org/bugzilla/>
@ 2021-09-15  0:54 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-15  0:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
With IVOPTs we get:
  # ivtmp.13_97 = PHI <ivtmp.13_96(12), 1(7)>
  _34 = MEM[(const __be32 *)_28 + -4B + ivtmp.13_97 * 4];
  _36 = MEM[(const __be32 *)_27 + -4B + ivtmp.13_97 * 4];
  if (_34 != _36)
    goto <bb 9>; [5.50%]
  else
    goto <bb 12>; [94.50%]

  <bb 9> [local count: 217424209]:
  _22 = (int) ivtmp.13_97;
  _40 = _22 * 32;
  xb_37 = _34 ^ _36;
  iftmp.1_53 = __fswab32 (xb_37);
  __asm__("clz  %0, %1" : "=r" ret_54 : "r" iftmp.1_53 : "cc");
  ret_56 = 32 - ret_54;
  _57 = _40 - ret_56;
  MEM[(struct ipv6_saddr_score *)&scores + 32B].matchlen = _57;
  if (_57 != 0)
    goto <bb 13>; [0.00%]
  else
    goto <bb 10>; [100.00%]

So there is no extra add one any more.
BUT with -fno-ivopts I still see the add one.

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

* [Bug tree-optimization/45256] Missed arithmetic simplification at tree level
  2010-08-11 15:19 [Bug tree-optimization/45256] New: " bernds at gcc dot gnu dot org
  2010-08-11 15:19 ` [Bug tree-optimization/45256] " bernds at gcc dot gnu dot org
  2010-09-07 13:09 ` ibolton at gcc dot gnu dot org
@ 2010-09-07 18:42 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-09-07 18:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2010-09-07 18:41 -------
ret_59 = (i_53 + 1) * 32 - (32 - ret_56)

So this looks like a re-association issue.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45256


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

* [Bug tree-optimization/45256] Missed arithmetic simplification at tree level
  2010-08-11 15:19 [Bug tree-optimization/45256] New: " bernds at gcc dot gnu dot org
  2010-08-11 15:19 ` [Bug tree-optimization/45256] " bernds at gcc dot gnu dot org
@ 2010-09-07 13:09 ` ibolton at gcc dot gnu dot org
  2010-09-07 18:42 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: ibolton at gcc dot gnu dot org @ 2010-09-07 13:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ibolton at gcc dot gnu dot org  2010-09-07 13:05 -------
(In reply to comment #1)
> Created an attachment (id=21454)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21454&action=view) [edit]
> Testcase
> 

OK.  I can see this happening on trunk, when compiled as follows:

arm-none-linux-gnueabi/obj/gcc3/gcc/cc1 -O2 pr45256.i -fdump-tree-all
-fdump-rtl-all.

The 148t.optimized dump shows exactly what has been posted above, where
effectively 32 is both added and then subtracted.

The 183r.dce dump still shows this extra work happening and the 184r.combine
dump shows that it has been optimised away.  It should be possible to do this
optimisation at the tree-level, so this bug is confirmed.

Should I check whether this happens for 4.4 and 4.5 too?


-- 

ibolton at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |missed-optimization
      Known to fail|                            |4.6.0
   Last reconfirmed|0000-00-00 00:00:00         |2010-09-07 13:05:49
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45256


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

* [Bug tree-optimization/45256] Missed arithmetic simplification at tree level
  2010-08-11 15:19 [Bug tree-optimization/45256] New: " bernds at gcc dot gnu dot org
@ 2010-08-11 15:19 ` bernds at gcc dot gnu dot org
  2010-09-07 13:09 ` ibolton at gcc dot gnu dot org
  2010-09-07 18:42 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: bernds at gcc dot gnu dot org @ 2010-08-11 15:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bernds at gcc dot gnu dot org  2010-08-11 15:19 -------
Created an attachment (id=21454)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21454&action=view)
Testcase


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45256


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

end of thread, other threads:[~2021-09-15  0:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-45256-4@http.gcc.gnu.org/bugzilla/>
2021-09-15  0:54 ` [Bug tree-optimization/45256] Missed arithmetic simplification at tree level pinskia at gcc dot gnu.org
2010-08-11 15:19 [Bug tree-optimization/45256] New: " bernds at gcc dot gnu dot org
2010-08-11 15:19 ` [Bug tree-optimization/45256] " bernds at gcc dot gnu dot org
2010-09-07 13:09 ` ibolton at gcc dot gnu dot org
2010-09-07 18:42 ` pinskia at gcc dot gnu dot 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).