-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[DA] Set Distance to zero when Direction is EQ #147966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ad3f5e9
c3338ba
20d5661
2a8f9c8
dcb6679
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -187,6 +187,18 @@ static void dumpExampleDependence(raw_ostream &OS, DependenceInfo *DA, | |
| OS << " da analyze - "; | ||
| if (auto D = DA->depends(&*SrcI, &*DstI, | ||
| /*UnderRuntimeAssumptions=*/true)) { | ||
|
|
||
| // Verify that the distance begin zero is equivalent to the | ||
| // direction being EQ. | ||
| for (unsigned Level = 1; Level <= D->getLevels(); Level++) { | ||
| const SCEV *Distance = D->getDistance(Level); | ||
| bool IsDistanceZero = Distance && Distance->isZero(); | ||
| bool IsDirectionEQ = | ||
| D->getDirection(Level) == Dependence::DVEntry::EQ; | ||
| assert(IsDistanceZero == IsDirectionEQ && | ||
| "Inconsistent distance and direction."); | ||
| } | ||
kasuga-fj marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // Normalize negative direction vectors if required by clients. | ||
| if (NormalizeResults && D->normalize(&SE)) | ||
| OS << "normalized - "; | ||
|
|
@@ -3991,6 +4003,23 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst, | |
| if (CompleteLoops[II]) | ||
| Result.DV[II - 1].Scalar = false; | ||
|
|
||
| // Set the distance to zero if the direction is EQ. | ||
| // TODO: Ideally, the distance should be set to 0 immediately simultaneously | ||
| // with the corresponding direction being set to EQ. | ||
| for (unsigned II = 1; II <= Result.getLevels(); ++II) { | ||
| if (Result.getDirection(II) == Dependence::DVEntry::EQ) | ||
|
||
| Result.DV[II - 1].Distance = SE->getZero(SrcSCEV->getType()); | ||
|
|
||
| LLVM_DEBUG({ | ||
| // Check that the converse (i.e., if the distance is zero, then the | ||
| // direction is EQ) holds. | ||
| const SCEV *Distance = Result.getDistance(II); | ||
| if (Distance && Distance->isZero()) | ||
| assert(Result.getDirection(II) == Dependence::DVEntry::EQ && | ||
| "Distance is zero, but direction is not EQ"); | ||
| }); | ||
kasuga-fj marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| if (PossiblyLoopIndependent) { | ||
| // Make sure the LoopIndependent flag is set correctly. | ||
| // All directions must include equal, otherwise no | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/begin/being?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks