public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/67607] New: Failure to perform constant folding through type conversion
@ 2015-09-17  7:46 miyuki at gcc dot gnu.org
  2015-09-17  8:15 ` [Bug tree-optimization/67607] " glisse at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: miyuki at gcc dot gnu.org @ 2015-09-17  7:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67607
           Summary: Failure to perform constant folding through type
                    conversion
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: miyuki at gcc dot gnu.org
  Target Milestone: ---

This code is taken from PR67606:

$ cat pr67606.c
int f(int a[], int length)
{
  int count=0;
  for (int i = 0 ; i < length ; i++)
    if (a[i] > 5)
      count++;

  return count;
}

$ g++ -S -O3 -fno-tree-vectorize pr67606.c -fverbose-asm -fdump-tree-optimized

We get:

  <bb 3>:
  ivtmp.6_1 = (unsigned long) a_7(D);
  _19 = (unsigned int) length_4(D);
  _18 = _19 + 4294967295;
  _21 = (sizetype) _18;
  _22 = _21 + 1;
  _23 = _22 * 4;
  _24 = a_7(D) + _23;
  _25 = (unsigned long) _24;

And this leads to generating some redundant code:

  leal    -1(%rsi), %eax  #, tmp114
  leaq    4(%rdi,%rax,4), %rcx    #, tmp111


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

end of thread, other threads:[~2015-09-21 11:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-17  7:46 [Bug tree-optimization/67607] New: Failure to perform constant folding through type conversion miyuki at gcc dot gnu.org
2015-09-17  8:15 ` [Bug tree-optimization/67607] " glisse at gcc dot gnu.org
2015-09-17  8:21 ` rguenth at gcc dot gnu.org
2015-09-21 11:39 ` glisse 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).