This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Remove redundant calls to copy_virtual_operands



Zdenek Dvorak <rakdver@kam.mff.cuni.cz> wrote on 08/08/2007 12:41:01:

> on the other hand, the fact that there are ICEs shows that there is some
> problem in setting the alias information for the new statements in
> vectorizer -- if this were correct, the virtual operands would be
> exactly the same as the ones of the original statement; so although I
> agree that leaving things to update_ssa is easier to maintain (although
> possibly much slower), it would be nice if someone could check what does
> the alias information updating code in vectorizer get wrong,

Currently the vectorizer both sets a memory tag and copies virtual
operands. Sometimes, like in the example below, the tag provided by the
vectorizer is more accurate than the alias information we had before, i.e.,
the virtual operands of the scalar memory operations (although I only have
a testcase for this on 4.1.1).

Here is the testcase (for gcc 4.1.1):

#define N 64

short AA[4096], BB[4096];

main()
{
  int j;

       for (j = 0; j < N; j++){
         *(AA+j) = 1.0;
         *(BB+j) = 1.0;
       }
}


After vectorization and copying vops from scalars we get:
 ...
  # BBD.1944_22 = PHI <BBD.1944_19(2), BBD.1944_14(4)>;
  # AAD.1943_21 = PHI <AAD.1943_18(2), AAD.1943_15(4)>;
<L0>:;
  ...
  #   AAD.1943_16 = V_MAY_DEF <AAD.1943_21>;
  #   BBD.1944_17 = V_MAY_DEF <BBD.1944_22>;
  *ivtmp.40D.2017_28 = vect_cst_.35D.2012_25;
  #   AAD.1943_18 = V_MAY_DEF <AAD.1943_16>;
  #   BBD.1944_19 = V_MAY_DEF <BBD.1944_17>;
  *ivtmp.46D.2024_33 = vect_cst_.41D.2019_30;
 ...

While the memtags the vectorizer sets distinguish between AA and BB.
Therefore, by both setting more accurate tags and copying less accurate
vops, we create an inconsistency.

The ICE we get on gcc 4.1.1 is that ivopts pass rewrites the memory
operations and calls update_stmt() to update vops based on the memtags set
by the vectorizer.
Here is what we get after ivopts pass:

  # BBD.1944_22 = PHI <BBD.1944_19(2), BBD.1944_14(0)>;
  # AAD.1943_21 = PHI <AAD.1943_18(2), AAD.1943_15(0)>;
<L0>:;
  ...
  #   AAD.1943_16 = V_MAY_DEF <AAD.1943_21>;
  MEM[base: &AAD.1943, index: D.2034_10]{*ivtmp.40D.2017} =
vect_cst_.35D.2012_25;
  ...
  #   BBD.1944_19 = V_MAY_DEF <BBD.1944_17>;
  MEM[base: &BBD.1944, index: D.2035_6]{*ivtmp.46D.2024} =
vect_cst_.41D.2019_30;
  ...

it removes V_MAY_DEF of BB when writing to AA and V_MAY_DEF of AA when
writing to BB. The problem is that the remaining defs are not updated and
verify_ssa fails (there is a use of BBD.1944_17 without a def).

Our assumption was that creating such an inconsistent information in the
vectorizer is incorrect. And that since by setting more accurate memtags we
improve the alias info, we should simply remove the calls to
copy_virtual_operands.

Thanks,
Ira

>
> Zdenek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]