public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/46281] New: Inefficient unswitching (too many copies)
@ 2010-11-02 22:23 davidxl at gcc dot gnu.org
  2010-11-03 11:00 ` [Bug tree-optimization/46281] " rguenth at gcc dot gnu.org
  2021-07-26  9:34 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: davidxl at gcc dot gnu.org @ 2010-11-02 22:23 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Inefficient unswitching (too many copies)
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: davidxl@gcc.gnu.org


Compiling the following program with -O3:

extern int gen_int(int);
extern void ref_int_p(int*);

void kernel3 ()
{
  int i;
  int j;
  int k;
  int l;
  int m;
  int a[200];

  j = gen_int (0);
  k = gen_int (0);
  l = gen_int (0);
  m = gen_int (0);

  for (i = 0; i < 200; i++)
    {
      if (j < k || j < l || j < m ) // || j << 3 || k << 4)
        a[i] = 1;
      else
        a[i] -= j;
    }

  ref_int_p (&a[0]);

  return;
}


Gcc unswitches the loop, but generate three copies of the loop -- it should
only generate 2 copies.

LLVM correctly generates two copies.

David


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

* [Bug tree-optimization/46281] Inefficient unswitching (too many copies)
  2010-11-02 22:23 [Bug tree-optimization/46281] New: Inefficient unswitching (too many copies) davidxl at gcc dot gnu.org
@ 2010-11-03 11:00 ` rguenth at gcc dot gnu.org
  2021-07-26  9:34 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-11-03 11:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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

* [Bug tree-optimization/46281] Inefficient unswitching (too many copies)
  2010-11-02 22:23 [Bug tree-optimization/46281] New: Inefficient unswitching (too many copies) davidxl at gcc dot gnu.org
  2010-11-03 11:00 ` [Bug tree-optimization/46281] " rguenth at gcc dot gnu.org
@ 2021-07-26  9:34 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-26  9:34 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-07-26

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note you need the uncommented part to hit the issue on the trunk
So:
if (j < k || j < l || j < m  || j << 3 || k << 4)

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

end of thread, other threads:[~2021-07-26  9:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-02 22:23 [Bug tree-optimization/46281] New: Inefficient unswitching (too many copies) davidxl at gcc dot gnu.org
2010-11-03 11:00 ` [Bug tree-optimization/46281] " rguenth at gcc dot gnu.org
2021-07-26  9:34 ` pinskia 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).