[llvm-mca] Correctly set the ReadAdvance information for register use operands.
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 29 Mar 2018 14:26:56 +0000 (14:26 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 29 Mar 2018 14:26:56 +0000 (14:26 +0000)
commit0a837ef6b13e34abb785c720c4fa3d79be45db0f
tree6100e362adef63da303999b61539b272ffc21bbb
parentfe1d346f996f9a7df76073e0cff2ebefdebc18cf
[llvm-mca] Correctly set the ReadAdvance information for register use operands.

The tool was passing the wrong operand index to method
MCSubtargetInfo::getReadAdvanceCycles(). That method requires a "UseIdx", and
not the operand index. This was found when testing X86 code where instructions
had a memory folded operand.

This patch fixes the issue and adds test read-advance-1.s to ensure that
the ReadAfterLd (a ReadAdvance of 3cy) information is correctly used.

llvm-svn: 328790
llvm/test/tools/llvm-mca/X86/BtVer2/read-advance-1.s [new file with mode: 0644]
llvm/tools/llvm-mca/Dispatch.cpp
llvm/tools/llvm-mca/InstrBuilder.cpp
llvm/tools/llvm-mca/Instruction.cpp
llvm/tools/llvm-mca/Instruction.h
llvm/tools/llvm-mca/Scheduler.cpp
llvm/tools/llvm-mca/Scheduler.h