Skip to content

[SandboxVec][DAG] Drop RAR and fix dependency scanning loop #111715

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

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ class DependencyGraph {
enum class DependencyType {
ReadAfterWrite, ///> Memory dependency write -> read
WriteAfterWrite, ///> Memory dependency write -> write
ReadAfterRead, ///> Memory dependency read -> read
WriteAfterRead, ///> Memory dependency read -> write
Control, ///> Control-related dependency, like with PHI/Terminator
Other, ///> Currently used for stack related instrs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ DependencyGraph::getRoughDepType(Instruction *FromI, Instruction *ToI) {
} else if (FromI->mayReadFromMemory()) {
if (ToI->mayWriteToMemory())
return DependencyType::WriteAfterRead;
if (ToI->mayReadFromMemory())
return DependencyType::ReadAfterRead;
}
if (isa<sandboxir::PHINode>(FromI) || isa<sandboxir::PHINode>(ToI))
return DependencyType::Control;
Expand Down Expand Up @@ -103,7 +101,7 @@ bool DependencyGraph::alias(Instruction *SrcI, Instruction *DstI,
// TODO: Check AABudget
ModRefInfo SrcModRef =
isOrdered(SrcI)
? ModRefInfo::Mod
? ModRefInfo::ModRef
: Utils::aliasAnalysisGetModRefInfo(*BatchAA, SrcI, *DstLocOpt);
switch (DepType) {
case DependencyType::ReadAfterWrite:
Expand All @@ -119,8 +117,6 @@ bool DependencyGraph::alias(Instruction *SrcI, Instruction *DstI,
bool DependencyGraph::hasDep(Instruction *SrcI, Instruction *DstI) {
DependencyType RoughDepType = getRoughDepType(SrcI, DstI);
switch (RoughDepType) {
case DependencyType::ReadAfterRead:
return false;
case DependencyType::ReadAfterWrite:
case DependencyType::WriteAfterWrite:
case DependencyType::WriteAfterRead:
Expand Down Expand Up @@ -174,9 +170,11 @@ Interval<Instruction> DependencyGraph::extend(ArrayRef<Instruction *> Instrs) {
}
// Create the dependencies.
auto DstRange = MemDGNodeIntervalBuilder::make(InstrInterval, *this);
for (MemDGNode &DstN : drop_begin(DstRange)) {
auto SrcRange = Interval<MemDGNode>(DstRange.top(), DstN.getPrevNode());
scanAndAddDeps(DstN, SrcRange);
if (!DstRange.empty()) {
for (MemDGNode &DstN : drop_begin(DstRange)) {
auto SrcRange = Interval<MemDGNode>(DstRange.top(), DstN.getPrevNode());
scanAndAddDeps(DstN, SrcRange);
}
}

return InstrInterval;
Expand Down
Loading