Skip to content

Commit 5c7ec29

Browse files
committed
MachineScheduler: better book-keeping for asserts.
Fixes another test case under PR20057. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212088 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent faa4e49 commit 5c7ec29

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

lib/CodeGen/MachineScheduler.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,7 +1690,7 @@ bool SchedBoundary::checkHazard(SUnit *SU) {
16901690
unsigned NRCycle = getNextResourceCycle(PI->ProcResourceIdx, PI->Cycles);
16911691
if (NRCycle > CurrCycle) {
16921692
#ifndef NDEBUG
1693-
MaxObservedStall = std::max(NRCycle - CurrCycle, MaxObservedStall);
1693+
MaxObservedStall = std::max(PI->Cycles, MaxObservedStall);
16941694
#endif
16951695
DEBUG(dbgs() << " SU(" << SU->NodeNum << ") "
16961696
<< SchedModel->getResourceName(PI->ProcResourceIdx)
@@ -1954,10 +1954,12 @@ void SchedBoundary::bumpNode(SUnit *SU) {
19541954
PE = SchedModel->getWriteProcResEnd(SC); PI != PE; ++PI) {
19551955
unsigned PIdx = PI->ProcResourceIdx;
19561956
if (SchedModel->getProcResource(PIdx)->BufferSize == 0) {
1957-
ReservedCycles[PIdx] = isTop() ? NextCycle + PI->Cycles : NextCycle;
1958-
#ifndef NDEBUG
1959-
MaxObservedStall = std::max(PI->Cycles, MaxObservedStall);
1960-
#endif
1957+
if (isTop()) {
1958+
ReservedCycles[PIdx] =
1959+
std::max(getNextResourceCycle(PIdx, 0), NextCycle + PI->Cycles);
1960+
}
1961+
else
1962+
ReservedCycles[PIdx] = NextCycle;
19611963
}
19621964
}
19631965
}

test/CodeGen/AArch64/arm64-misched-basic-A53.ll

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,32 @@ entry:
172172
}
173173

174174
declare void @llvm.trap()
175+
176+
; Regression test for PR20057: "permanent hazard"'
177+
; Resource contention on LDST.
178+
; CHECK: ********** MI Scheduling **********
179+
; CHECK: testLdStConflict
180+
; CHECK: *** Final schedule for BB#1 ***
181+
; CHECK: LD4Fourv2d
182+
; CHECK: STRQui
183+
; CHECK: ********** INTERVALS **********
184+
define void @testLdStConflict() {
185+
entry:
186+
br label %loop
187+
188+
loop:
189+
%0 = call { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld4.v2i64.p0i8(i8* null)
190+
%ptr = bitcast i8* undef to <2 x i64>*
191+
store <2 x i64> zeroinitializer, <2 x i64>* %ptr, align 4
192+
%ptr1 = bitcast i8* undef to <2 x i64>*
193+
store <2 x i64> zeroinitializer, <2 x i64>* %ptr1, align 4
194+
%ptr2 = bitcast i8* undef to <2 x i64>*
195+
store <2 x i64> zeroinitializer, <2 x i64>* %ptr2, align 4
196+
%ptr3 = bitcast i8* undef to <2 x i64>*
197+
store <2 x i64> zeroinitializer, <2 x i64>* %ptr3, align 4
198+
%ptr4 = bitcast i8* undef to <2 x i64>*
199+
store <2 x i64> zeroinitializer, <2 x i64>* %ptr4, align 4
200+
br label %loop
201+
}
202+
203+
declare { <2 x i64>, <2 x i64>, <2 x i64>, <2 x i64> } @llvm.aarch64.neon.ld4.v2i64.p0i8(i8*)

0 commit comments

Comments
 (0)