Skip to content

[ScheduleDAG] Dirty height/depth in addPred/removePred even for latency zero #102915

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
Aug 20, 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
15 changes: 7 additions & 8 deletions llvm/lib/CodeGen/ScheduleDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ bool SUnit::addPred(const SDep &D, bool Required) {
}
}
PredDep.setLatency(D.getLatency());
// Changing latency, dirty the involved SUnits.
this->setDepthDirty();
D.getSUnit()->setHeightDirty();
}
return false;
}
Expand Down Expand Up @@ -164,10 +167,8 @@ bool SUnit::addPred(const SDep &D, bool Required) {
}
Preds.push_back(D);
N->Succs.push_back(P);
if (P.getLatency() != 0) {
this->setDepthDirty();
N->setHeightDirty();
}
this->setDepthDirty();
N->setHeightDirty();
return true;
}

Expand Down Expand Up @@ -209,10 +210,8 @@ void SUnit::removePred(const SDep &D) {
}
N->Succs.erase(Succ);
Preds.erase(I);
if (P.getLatency() != 0) {
this->setDepthDirty();
N->setHeightDirty();
}
this->setDepthDirty();
N->setHeightDirty();
}

void SUnit::setDepthDirty() {
Expand Down
39 changes: 18 additions & 21 deletions llvm/test/CodeGen/AArch64/abds.ll
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,13 @@ define i64 @abd_ext_i64_undef(i64 %a, i64 %b) nounwind {
define i128 @abd_ext_i128(i128 %a, i128 %b) nounwind {
; CHECK-LABEL: abd_ext_i128:
; CHECK: // %bb.0:
; CHECK-NEXT: cmp x2, x0
; CHECK-NEXT: sbc x8, x3, x1
; CHECK-NEXT: subs x9, x0, x2
; CHECK-NEXT: sbc x10, x1, x3
; CHECK-NEXT: subs x11, x2, x0
; CHECK-NEXT: subs x8, x0, x2
; CHECK-NEXT: sbc x9, x1, x3
; CHECK-NEXT: subs x10, x2, x0
; CHECK-NEXT: sbc x11, x3, x1
; CHECK-NEXT: sbcs xzr, x3, x1
; CHECK-NEXT: csel x0, x9, x11, lt
; CHECK-NEXT: csel x1, x10, x8, lt
; CHECK-NEXT: csel x0, x8, x10, lt
; CHECK-NEXT: csel x1, x9, x11, lt
; CHECK-NEXT: ret
%aext = sext i128 %a to i256
%bext = sext i128 %b to i256
Expand All @@ -200,14 +199,13 @@ define i128 @abd_ext_i128(i128 %a, i128 %b) nounwind {
define i128 @abd_ext_i128_undef(i128 %a, i128 %b) nounwind {
; CHECK-LABEL: abd_ext_i128_undef:
; CHECK: // %bb.0:
; CHECK-NEXT: cmp x2, x0
; CHECK-NEXT: sbc x8, x3, x1
; CHECK-NEXT: subs x9, x0, x2
; CHECK-NEXT: sbc x10, x1, x3
; CHECK-NEXT: subs x11, x2, x0
; CHECK-NEXT: subs x8, x0, x2
; CHECK-NEXT: sbc x9, x1, x3
; CHECK-NEXT: subs x10, x2, x0
; CHECK-NEXT: sbc x11, x3, x1
; CHECK-NEXT: sbcs xzr, x3, x1
; CHECK-NEXT: csel x0, x9, x11, lt
; CHECK-NEXT: csel x1, x10, x8, lt
; CHECK-NEXT: csel x0, x8, x10, lt
; CHECK-NEXT: csel x1, x9, x11, lt
; CHECK-NEXT: ret
%aext = sext i128 %a to i256
%bext = sext i128 %b to i256
Expand Down Expand Up @@ -278,14 +276,13 @@ define i64 @abd_minmax_i64(i64 %a, i64 %b) nounwind {
define i128 @abd_minmax_i128(i128 %a, i128 %b) nounwind {
; CHECK-LABEL: abd_minmax_i128:
; CHECK: // %bb.0:
; CHECK-NEXT: cmp x2, x0
; CHECK-NEXT: sbc x8, x3, x1
; CHECK-NEXT: subs x9, x0, x2
; CHECK-NEXT: sbc x10, x1, x3
; CHECK-NEXT: subs x11, x2, x0
; CHECK-NEXT: subs x8, x0, x2
; CHECK-NEXT: sbc x9, x1, x3
; CHECK-NEXT: subs x10, x2, x0
; CHECK-NEXT: sbc x11, x3, x1
; CHECK-NEXT: sbcs xzr, x3, x1
; CHECK-NEXT: csel x0, x9, x11, lt
; CHECK-NEXT: csel x1, x10, x8, lt
; CHECK-NEXT: csel x0, x8, x10, lt
; CHECK-NEXT: csel x1, x9, x11, lt
; CHECK-NEXT: ret
%min = call i128 @llvm.smin.i128(i128 %a, i128 %b)
%max = call i128 @llvm.smax.i128(i128 %a, i128 %b)
Expand Down
Loading