diff options
author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-03-08 20:21:55 +0000 |
---|---|---|
committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-03-08 20:21:55 +0000 |
commit | 373c38a2db3787b60a5d2588922e8b8eac389d17 (patch) | |
tree | 1e20157e34fc430c6152e4c3c1bd75d0de7ce16c /llvm/tools/llvm-mca | |
parent | f0bcbfef5cc86e0f805ffeb64733e774f7c7bc0e (diff) | |
download | bcm5719-llvm-373c38a2db3787b60a5d2588922e8b8eac389d17.tar.gz bcm5719-llvm-373c38a2db3787b60a5d2588922e8b8eac389d17.zip |
[llvm-mca] Fix handling of zero-latency instructions.
This patch fixes a problem found when testing zero latency instructions on
target AArch64 -mcpu=exynos-m3 / -mcpu=exynos-m1.
On Exynos-m3/m1, direct branches are zero-latency instructions that don't consume
any processor resources. The DispatchUnit marks zero-latency instructions as
"executed", so that no scheduling is required. The event of instruction
executed is then notified to all the listeners, and the reorder buffer (managed
by the RetireControlUnit) is updated. In particular, the entry associated to the
zero-latency instruction in the reorder buffer is marked as executed.
Before this patch, the DispatchUnit forgot to assign a retire control unit token
(RCUToken) to the zero-latency instruction. As a consequence, the RCUToken was
used uninitialized. This was causing a crash in the RetireControlUnit logic.
Fixes PR36650.
llvm-svn: 327056
Diffstat (limited to 'llvm/tools/llvm-mca')
-rw-r--r-- | llvm/tools/llvm-mca/Backend.cpp | 5 | ||||
-rw-r--r-- | llvm/tools/llvm-mca/Dispatch.cpp | 1 | ||||
-rw-r--r-- | llvm/tools/llvm-mca/Scheduler.cpp | 1 |
3 files changed, 2 insertions, 5 deletions
diff --git a/llvm/tools/llvm-mca/Backend.cpp b/llvm/tools/llvm-mca/Backend.cpp index 62e239524dd..fab725aecf7 100644 --- a/llvm/tools/llvm-mca/Backend.cpp +++ b/llvm/tools/llvm-mca/Backend.cpp @@ -43,11 +43,6 @@ void Backend::runCycle(unsigned Cycle) { Instructions[IR.first] = std::unique_ptr<Instruction>(NewIS); NewIS->setRCUTokenID(DU->dispatch(IR.first, NewIS)); - // If this is a zero latency instruction, then we don't need to dispatch - // it. Instead, we can mark it as executed. - if (NewIS->isZeroLatency()) - notifyInstructionExecuted(IR.first); - // Check if we have dispatched all the instructions. SM.updateNext(); if (!SM.hasNext()) diff --git a/llvm/tools/llvm-mca/Dispatch.cpp b/llvm/tools/llvm-mca/Dispatch.cpp index c5c560ca2f3..8a08339265a 100644 --- a/llvm/tools/llvm-mca/Dispatch.cpp +++ b/llvm/tools/llvm-mca/Dispatch.cpp @@ -242,6 +242,7 @@ unsigned DispatchUnit::dispatch(unsigned IID, Instruction *NewInst) { // Reserve slots in the RCU. unsigned RCUTokenID = RCU->reserveSlot(IID, NumMicroOps); + NewInst->setRCUTokenID(RCUTokenID); Owner->notifyInstructionDispatched(IID); SC->scheduleInstruction(IID, NewInst); diff --git a/llvm/tools/llvm-mca/Scheduler.cpp b/llvm/tools/llvm-mca/Scheduler.cpp index 8608a06b8df..6c0c44bd4d7 100644 --- a/llvm/tools/llvm-mca/Scheduler.cpp +++ b/llvm/tools/llvm-mca/Scheduler.cpp @@ -264,6 +264,7 @@ Instruction *Scheduler::scheduleInstruction(unsigned Idx, Instruction *MCIS) { // eliminated at register renaming stage, since we know in advance that those // clear their output register. if (MCIS->isZeroLatency()) { + notifyInstructionReady(Idx); MCIS->forceExecuted(); notifyInstructionIssued(Idx, {}); notifyInstructionExecuted(Idx); |