Skip to content

Commit fdd62e7

Browse files
fixup! handle instruction executed in updateCarriedOver
1 parent a72081c commit fdd62e7

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

llvm/lib/MCA/Stages/InOrderIssueStage.cpp

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ llvm::Error InOrderIssueStage::tryIssue(InstRef &IR) {
258258

259259
// If the instruction has a latency of 0, we need to handle
260260
// the execution and retirement now. If the instruction is issued in multiple
261-
// cycles, we cannot retire until it is finished issuing.
261+
// cycles, we cannot handle the instruction being executed here so we make
262+
// updateCarriedOver responsible.
262263
if (IS.isExecuted() && !ShouldCarryOver) {
263264
PRF.onInstructionExecuted(&IS);
264265
LSU.onInstructionExecuted(IR);
@@ -295,15 +296,16 @@ void InOrderIssueStage::updateIssuedInst() {
295296
continue;
296297
}
297298

298-
PRF.onInstructionExecuted(&IS);
299-
LSU.onInstructionExecuted(IR);
300-
notifyInstructionExecuted(IR);
301-
++NumExecuted;
299+
// Allow updateCarriedOver to handle the instruction being executed if the
300+
// instruction takes multiple cycles to issue.
301+
if (!CarriedOver) {
302+
PRF.onInstructionExecuted(&IS);
303+
LSU.onInstructionExecuted(IR);
304+
notifyInstructionExecuted(IR);
305+
++NumExecuted;
302306

303-
// Allow updateCarriedOver to retire the instruction if the instruction
304-
// takes multiple cycles to issue.
305-
if (!CarriedOver)
306307
retireInstruction(*I);
308+
}
307309

308310
std::iter_swap(I, E - NumExecuted);
309311
}
@@ -333,9 +335,16 @@ void InOrderIssueStage::updateCarriedOver() {
333335
else
334336
Bandwidth -= CarryOver;
335337

336-
// updateIssuedInst did not retireInstruction if it was carried over.
337-
if (CarriedOver.getInstruction()->isExecuted())
338+
// updateIssuedInst did not handle executed if issue had carry over.
339+
if (CarriedOver.getInstruction()->isExecuted()) {
340+
PRF.onInstructionExecuted(&IS);
341+
LSU.onInstructionExecuted(IR);
342+
notifyEvent<HWInstructionEvent>(
343+
HWInstructionEvent(HWInstructionEvent::Executed, IR));
344+
LLVM_DEBUG(dbgs() << "[E] Instruction #" << IR << " is executed\n");
345+
338346
retireInstruction(CarriedOver);
347+
}
339348

340349
CarriedOver = InstRef();
341350
CarryOver = 0;

0 commit comments

Comments
 (0)