[MBP] Use profile count to compute tail dup cost if it is available
authorGuozhi Wei <carrot@google.com>
Tue, 21 Jul 2020 18:18:06 +0000 (11:18 -0700)
committerGuozhi Wei <carrot@google.com>
Tue, 21 Jul 2020 18:18:06 +0000 (11:18 -0700)
commit28759e9fcc44274021ffeebc175863a4918e3cfd
treeecb83743072268e2a162083e044013e77b17b53e
parent7bedae7deeb581c6cf3bfa9d28263c00cfcccf4a
[MBP] Use profile count to compute tail dup cost if it is available

Current tail duplication in machine block placement pass uses block frequency
information in cost model. But frequency number has only relative meaning
compared to other basic blocks in the same function. A large frequency number
doesn't mean it is hot and a small frequency number doesn't mean it is cold.

To overcome this problem, this patch uses profile count in cost model if it's
available. So we can tail duplicate real hot basic blocks.

Differential Revision: https://reviews.llvm.org/D83265
llvm/lib/CodeGen/MachineBlockPlacement.cpp
llvm/test/CodeGen/X86/dup-cost.ll [new file with mode: 0644]