[Bug tree-optimization/49771] [4.7 Regression] wrong code with -ftree-vectorize

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 18 14:13:00 GMT 2011


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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-18 14:12:49 UTC ---
That commit looks bogus, the change it made is:
   # ivtmp.37_45 = PHI <ivtmp.37_43(6), ivtmp.37_46(2)>
   vect_pa.7_44 = (vector(4) int *) ivtmp.37_45;
-  D.2731_1 = vect_pa.7_44 < &a;
-  D.2733_14 = vect_pa.7_44 > &a[1000];
+  D.2731_1 = vect_pa.7_44 <= &a;
+  D.2733_14 = vect_pa.7_44 >= &a[1000];
   D.2734_23 = D.2733_14 | D.2731_1;
   if (D.2734_23 != 0)

vect_pa.7_44 is the pointer that goes from &a[0] to &a[999].  While in this
case it is fine to change the second > to >=, changing the first one is of
course wrong, because in the first iteration it will overlap, yet this test
will say that they do not.
What is weird is that segment_length_a in vect_create_cond_for_alias_checks
is 0 instead of 4 (sizeof (int)) I'd expect, while segment_length_b is the
expected 4000.  Apparently DR_STEP in the first case is 0.  I wonder whether
the change of the comparison should only be done if one segment length is empty
(and thus clearly doesn't include all bytes of the read/store), or something
similar.



More information about the Gcc-bugs mailing list