public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/102384] New: Missing optimization for pcom after enable O2 vectorization
@ 2021-09-17  2:48 crazylht at gmail dot com
  2021-09-17  7:14 ` [Bug tree-optimization/102384] " rguenth at gcc dot gnu.org
  2021-09-17  7:58 ` crazylht at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: crazylht at gmail dot com @ 2021-09-17  2:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102384
           Summary: Missing optimization for pcom after enable O2
                    vectorization
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu

testcase is from gcc.dg/tree-ssa/predcom-dse-3.c

void __attribute__((noinline)) foo4 (int *a)
{
  int i;
  for (i = 0; i < 100; i++)
    {
      a[i] = 0;
      a[i + 3] = -1;
    }
}

novectorize vs vectorize dump

@@ -1576,111 +1576,86 @@ void foo3 (int * a)
 ;; Function foo4 (foo4, funcdef_no=4, decl_uid=2022, cgraph_uid=5,
symbol_order=12)

 Processing loop 1
-Creating dr for *_3
...skipping...
-  _5 = _4 * 4;
-  _6 = a_10(D) + _5;
-  i_13 = i_17 + 1;
-  ivtmp_15 = ivtmp_16 - 1;
-  if (ivtmp_15 != 0)
-    goto <bb 5>; [98.99%]
+  vect_cst__14 = { 0, 0 };
+  vect_cst__22 = { -1, -1 };
+  vectp_a.59_23 = a_10(D) + 12;
+
+  <bb 3> [local count: 536870800]:
+  # vectp_a.56_19 = PHI <vectp_a.56_20(5), a_10(D)(2)>
+  # vectp_a.58_24 = PHI <vectp_a.58_25(5), vectp_a.59_23(2)>
+  # ivtmp_27 = PHI <ivtmp_28(5), 0(2)>
+  MEM <vector(2) int> [(int *)vectp_a.56_19] = vect_cst__14;
+  MEM <vector(2) int> [(int *)vectp_a.58_24] = vect_cst__22;---- this is bad
+  vectp_a.56_20 = vectp_a.56_19 + 8;
+  vectp_a.58_25 = vectp_a.58_24 + 8;
+  ivtmp_28 = ivtmp_27 + 1;
+  if (ivtmp_28 < 50)
+    goto <bb 5>; [98.00%]
   else
-    goto <bb 4>; [1.01%]
+    goto <bb 4>; [2.00%]

-  <bb 5> [local count: 1052266996]:
+  <bb 5> [local count: 526133384]:
   goto <bb 3>; [100.00%]

   <bb 4> [local count: 10737416]:
-  MEM[(int *)a_10(D) + 400B] = -1; ---- this is good
-  MEM[(int *)a_10(D) + 404B] = -1;
-  MEM[(int *)a_10(D) + 408B] = -1;
   return;

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

* [Bug tree-optimization/102384] Missing optimization for pcom after enable O2 vectorization
  2021-09-17  2:48 [Bug tree-optimization/102384] New: Missing optimization for pcom after enable O2 vectorization crazylht at gmail dot com
@ 2021-09-17  7:14 ` rguenth at gcc dot gnu.org
  2021-09-17  7:58 ` crazylht at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-09-17  7:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-09-17

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is that we have no way to express the data dependence of these
partial overlapping stores and since predcom works with data dependences
there's nothing to do.

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

* [Bug tree-optimization/102384] Missing optimization for pcom after enable O2 vectorization
  2021-09-17  2:48 [Bug tree-optimization/102384] New: Missing optimization for pcom after enable O2 vectorization crazylht at gmail dot com
  2021-09-17  7:14 ` [Bug tree-optimization/102384] " rguenth at gcc dot gnu.org
@ 2021-09-17  7:58 ` crazylht at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: crazylht at gmail dot com @ 2021-09-17  7:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
The issue also exists for -O3.

__attribute__((noinline))
void foo4 (int * a)
{
  int * _20;

  <bb 2> [local count: 10737416]:
  _20 = a_10(D) + 12;
  __builtin_memset (_20, 255, 400);
  __builtin_memset (a_10(D), 0, 400); [tail call]
  return;

}

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

end of thread, other threads:[~2021-09-17  7:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17  2:48 [Bug tree-optimization/102384] New: Missing optimization for pcom after enable O2 vectorization crazylht at gmail dot com
2021-09-17  7:14 ` [Bug tree-optimization/102384] " rguenth at gcc dot gnu.org
2021-09-17  7:58 ` crazylht at gmail dot com

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).