[llvm-mca] Fix handling of zero-latency instructions.
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 8 Mar 2018 20:21:55 +0000 (20:21 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 8 Mar 2018 20:21:55 +0000 (20:21 +0000)
commit373c38a2db3787b60a5d2588922e8b8eac389d17
tree1e20157e34fc430c6152e4c3c1bd75d0de7ce16c
parentf0bcbfef5cc86e0f805ffeb64733e774f7c7bc0e
[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
llvm/test/tools/llvm-mca/AArch64/CortexA57/direct-branch.s [new file with mode: 0644]
llvm/test/tools/llvm-mca/AArch64/Exynos/direct-branch.s [new file with mode: 0644]
llvm/test/tools/llvm-mca/AArch64/lit.local.cfg [new file with mode: 0644]
llvm/tools/llvm-mca/Backend.cpp
llvm/tools/llvm-mca/Dispatch.cpp
llvm/tools/llvm-mca/Scheduler.cpp