[llvm-mca] Fix an invalid memory read introduced by r346487.
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 22 Nov 2018 12:48:57 +0000 (12:48 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 22 Nov 2018 12:48:57 +0000 (12:48 +0000)
commit1cb8a3c690ab86925ab27b394b66f08a3e69fa15
tree7162042c5a372b8735cba1a5bb8b04dd3f985064
parentb565e6093bc349f935a3944c0c8667e9bfa7927c
[llvm-mca] Fix an invalid memory read introduced by r346487.

This patch fixes an invalid memory read introduced by r346487.
Before this patch, partial register write had to query the latency of the
dependent full register write by calling a method on the full write descriptor.
However, if the full write is from an already retired instruction, chances are
that the EntryStage already reclaimed its memory.
In some parial register write tests, valgrind was reporting an invalid
memory read.

This change fixes the invalid memory access problem. Writes are now responsible
for tracking dependent partial register writes, and notify them in the event of
instruction issued.
That means, partial register writes no longer need to query their associated
full write to check when they are ready to execute.

Added test X86/BtVer2/partial-reg-update-7.s

llvm-svn: 347459
llvm/test/tools/llvm-mca/X86/BtVer2/partial-reg-update-7.s [new file with mode: 0644]
llvm/tools/llvm-mca/include/Instruction.h
llvm/tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp
llvm/tools/llvm-mca/lib/Instruction.cpp