public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/96831] New: gcc.dg/tree-ssa/scev-[345].c FAIL on i?86 and arm
@ 2020-08-28  9:23 rguenth at gcc dot gnu.org
  2020-08-28  9:26 ` [Bug tree-optimization/96831] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-28  9:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96831
           Summary: gcc.dg/tree-ssa/scev-[345].c FAIL on i?86 and arm
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

The testcases now FAIL after dumping TARGET_MEM_REF bases as &a instead of
symbol: a and thus show that IVOPTs doesn't consider using a pointer IV:

For lp64 (x86_64) I see

  <bb 4> :
  _10 = (sizetype) k_4(D);
  _8 = _10 * 8;
  _6 = (sizetype) k_4(D);
  _3 = _6 * 8;
  _2 = _3 + 4;
  _1 = &a + _2;
  ivtmp.5_7 = (unsigned long) _1;

  <bb 5> :
  # i_12 = PHI <k_4(D)(4), i_9(6)>
  # ivtmp.5_5 = PHI <ivtmp.5_7(4), ivtmp.5_11(6)>
  _1_16 = (int *) ivtmp.5_5;
  a_p = _1_16;
  _19 = (void *) ivtmp.5_5;
  MEM[(int *)_19] = 100;
  i_9 = k_4(D) + i_12;
  ivtmp.5_11 = ivtmp.5_5 + _8;
  if (i_9 <= 999)

so the ADDRESS use and the dereference use use the same IV.  But with ilp32
we end up with

  <bb 5> :
  # i_12 = PHI <k_4(D)(4), i_9(6)>
  _5 = (unsigned int) &a;
  _11 = (unsigned int) i_12;
  _10 = _11 * 8;
  _8 = _5 + _10;
  _7 = _8 + 4;
  _6 = (int *) _7;
  _1_16 = _6;
  a_p = _1_16;
  _3 = (sizetype) i_12;
  MEM[(int *)&a + _3 * 8] = 100;
  i_9 = k_4(D) + i_12;
  if (i_9 <= 999)

(scev-4.c) and eventually

.L2:
        movl    $100, a+4(,%eax,8)
        leal    a+4(,%eax,8), %ecx
        addl    %edx, %eax
        cmpl    $999, %eax
        jle     .L2
        movl    %ecx, a_p

instead of

.L3:
        addl    %edi, %ecx
        movl    $100, (%rax)
        movq    %rax, %rsi
        addq    %rdx, %rax
        cmpl    $999, %ecx
        jle     .L3
        movq    %rsi, a_p(%rip)

it's not entirely clear whether based on costs one is better than the other
(we are not able to replace the COMPARE use and thus the tested for variant
uses one more IV).

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

* [Bug tree-optimization/96831] gcc.dg/tree-ssa/scev-[345].c FAIL on i?86 and arm
  2020-08-28  9:23 [Bug tree-optimization/96831] New: gcc.dg/tree-ssa/scev-[345].c FAIL on i?86 and arm rguenth at gcc dot gnu.org
@ 2020-08-28  9:26 ` rguenth at gcc dot gnu.org
  2020-08-28  9:28 ` rguenth at gcc dot gnu.org
  2023-12-09 18:07 ` hp at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-28  9:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amker at gcc dot gnu.org,
                   |                            |liujiangning at gcc dot gnu.org
             Target|                            |i?86-*-* arm

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
CCing IVOPTs people as well as who originally contributed the testcases.

It might be restricting the testcase to a subset of targets is the correct
thing to do (if it is really a cost issue).

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

* [Bug tree-optimization/96831] gcc.dg/tree-ssa/scev-[345].c FAIL on i?86 and arm
  2020-08-28  9:23 [Bug tree-optimization/96831] New: gcc.dg/tree-ssa/scev-[345].c FAIL on i?86 and arm rguenth at gcc dot gnu.org
  2020-08-28  9:26 ` [Bug tree-optimization/96831] " rguenth at gcc dot gnu.org
@ 2020-08-28  9:28 ` rguenth at gcc dot gnu.org
  2023-12-09 18:07 ` hp at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-28  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I guess what is clearly missing is IVOPTs rewriting the ADDRESS uses with
the IV based on TARGET_MEM_REFs, thus &MEM[(int *)&a + _3 * 8].  Not sure
how hard that would be (do we even query targets for 'lea' capabilities?)

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

* [Bug tree-optimization/96831] gcc.dg/tree-ssa/scev-[345].c FAIL on i?86 and arm
  2020-08-28  9:23 [Bug tree-optimization/96831] New: gcc.dg/tree-ssa/scev-[345].c FAIL on i?86 and arm rguenth at gcc dot gnu.org
  2020-08-28  9:26 ` [Bug tree-optimization/96831] " rguenth at gcc dot gnu.org
  2020-08-28  9:28 ` rguenth at gcc dot gnu.org
@ 2023-12-09 18:07 ` hp at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: hp at gcc dot gnu.org @ 2023-12-09 18:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96831
Bug 96831 depends on bug 112786, which changed state.

Bug 112786 Summary: [14 Regression] gcc.dg/tree-ssa/scev-3.c scev-4.c and scev-5.c XPASSing on most ilp32 targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112786

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

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

end of thread, other threads:[~2023-12-09 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28  9:23 [Bug tree-optimization/96831] New: gcc.dg/tree-ssa/scev-[345].c FAIL on i?86 and arm rguenth at gcc dot gnu.org
2020-08-28  9:26 ` [Bug tree-optimization/96831] " rguenth at gcc dot gnu.org
2020-08-28  9:28 ` rguenth at gcc dot gnu.org
2023-12-09 18:07 ` hp 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).