This is an archive of the discontinued LLVM Phabricator instance.

[LAA] LLE 4/6: APIs to access the dependent instructions for a dependence, NFC
ClosedPublic

Authored by anemet on Sep 29 2015, 10:28 AM.

Details

Summary

The functions use LAI and MemoryDepChecker classes so they need to be
defined after those definitions outside of the Dependence class.

Will be used by the LoopLoadElimination pass.

Diff Detail

Repository
rL LLVM

Event Timeline

anemet updated this revision to Diff 36001.Sep 29 2015, 10:28 AM
anemet retitled this revision from to [LAA] LLE 4/6: APIs to access the dependent instructions for a dependence, NFC.
anemet updated this object.
anemet added a reviewer: hfinkel.
anemet added a subscriber: llvm-commits.

I'm not sure why this cannot be squashed into the next step. But LGTM, too.

hfinkel accepted this revision.Nov 2 2015, 9:52 AM
hfinkel edited edge metadata.

LGTM.

Maybe I'm overlooking some existing commentary, but we should do a better job of documenting what the source and destination mean where there are multiple possible sources and/or destinations of the same distance. To be clear about what I mean, if I take your example from D13254:

for (unsigned i = 0; i < 100; i++) {
  A[i+8] = B[i] + 2;
  C[i] = A[i] * 2;
}

and I do this:

for (unsigned i = 0; i < 100; i++) {
  A[i+8] = B[i] + 2;
  A[i+8] = F[i] + 2;
  C[i] = A[i] * 2;
  D[i] = A[i] * 4;
}

are there multiple distance-8 dependencies, or only one for A[i] <-> A[i+8], and if only one, to which A[i+8] store does it refer (the first or the second). I realize this is a bit silly here, because one of these stores is dead, but generally speaking, we should define how this is represented.

This revision is now accepted and ready to land.Nov 2 2015, 9:52 AM
anemet added a comment.Nov 2 2015, 3:45 PM

LGTM.

Thanks for the reviews, Hal!

Maybe I'm overlooking some existing commentary, but we should do a better job of documenting what the source and destination mean where there are multiple possible sources and/or destinations of the same distance. To be clear about what I mean, if I take your example from D13254:

for (unsigned i = 0; i < 100; i++) {
  A[i+8] = B[i] + 2;
  C[i] = A[i] * 2;
}

and I do this:

for (unsigned i = 0; i < 100; i++) {
  A[i+8] = B[i] + 2;
  A[i+8] = F[i] + 2;
  C[i] = A[i] * 2;
  D[i] = A[i] * 4;
}

are there multiple distance-8 dependencies, or only one for A[i] <-> A[i+8], and if only one, to which A[i+8] store does it refer (the first or the second). I realize this is a bit silly here, because one of these stores is dead, but generally speaking, we should define how this is represented.

There are multiple (=4) because kills are not taken into consideration. We just look at the pointers with the same underlying object, whether they are read or write and their order. So we get the full combination {S1, S2} -> {S3, S4}.

Let me add a comment about this.

This revision was automatically updated to reflect the committed changes.

Maybe I'm overlooking some existing commentary, but we should do a better job of documenting what the source and destination mean where there are multiple possible sources and/or destinations of the same distance. To be clear about what I mean, if I take your example from D13254:

for (unsigned i = 0; i < 100; i++) {
  A[i+8] = B[i] + 2;
  C[i] = A[i] * 2;
}

and I do this:

for (unsigned i = 0; i < 100; i++) {
  A[i+8] = B[i] + 2;
  A[i+8] = F[i] + 2;
  C[i] = A[i] * 2;
  D[i] = A[i] * 4;
}

are there multiple distance-8 dependencies, or only one for A[i] <-> A[i+8], and if only one, to which A[i+8] store does it refer (the first or the second). I realize this is a bit silly here, because one of these stores is dead, but generally speaking, we should define how this is represented.

Hal, sorry for the huge delay on this but now that I got back to this and reread your question, I think I understand the disconnect. Dependence objects are between instructions and *not* between pointers/accesses. (This is one change when LAA was moved out of LV and the interface was generalized.) Thus we will have multiple distance-8 dependence here as I said in my original reply.

There is a comment before the Dependence class mentioning that this is a relation between instructions (and not pointers/accesses):

/// \brief Dependece between memory access instructions.
struct Dependence {

Let me know if that's sufficient or you want me to elaborate somehow.

Thanks,
Adam

Maybe I'm overlooking some existing commentary, but we should do a better job of documenting what the source and destination mean where there are multiple possible sources and/or destinations of the same distance. To be clear about what I mean, if I take your example from D13254:

for (unsigned i = 0; i < 100; i++) {
  A[i+8] = B[i] + 2;
  C[i] = A[i] * 2;
}

and I do this:

for (unsigned i = 0; i < 100; i++) {
  A[i+8] = B[i] + 2;
  A[i+8] = F[i] + 2;
  C[i] = A[i] * 2;
  D[i] = A[i] * 4;
}

are there multiple distance-8 dependencies, or only one for A[i] <-> A[i+8], and if only one, to which A[i+8] store does it refer (the first or the second). I realize this is a bit silly here, because one of these stores is dead, but generally speaking, we should define how this is represented.

Hal, sorry for the huge delay on this but now that I got back to this and reread your question, I think I understand the disconnect. Dependence objects are between instructions and *not* between pointers/accesses. (This is one change when LAA was moved out of LV and the interface was generalized.) Thus we will have multiple distance-8 dependence here as I said in my original reply.

There is a comment before the Dependence class mentioning that this is a relation between instructions (and not pointers/accesses):

/// \brief Dependece between memory access instructions.
struct Dependence {

Let me know if that's sufficient or you want me to elaborate somehow.

I think that's sufficient. Thanks for following-up.

Thanks,
Adam