aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2022-04-20 11:37:53 -0400
committerMatt Arsenault <Matthew.Arsenault@amd.com>2022-06-01 09:15:41 -0400
commita0dcbe45bd8387da51f94e4d171c3ecc3d266e64 (patch)
tree85370b39f3ffaa80150446372a7a86f9c14d8451 /llvm/tools/llvm-reduce/ReducerWorkItem.cpp
parent2011052150e1a2fb8586b030126f8bec338f4cc5 (diff)
downloadllvm-a0dcbe45bd8387da51f94e4d171c3ecc3d266e64.zip
llvm-a0dcbe45bd8387da51f94e4d171c3ecc3d266e64.tar.gz
llvm-a0dcbe45bd8387da51f94e4d171c3ecc3d266e64.tar.bz2
llvm-reduce: Add reduction pass to remove regalloc hints
I'm a bit confused by what's actually stored for the allocation hints. The MIR parser only handles the "simple" case where there's a single hint. I don't really understand the assertion in clearSimpleHint, or under what circumstances there are multiple hint registers.
Diffstat (limited to 'llvm/tools/llvm-reduce/ReducerWorkItem.cpp')
-rw-r--r--llvm/tools/llvm-reduce/ReducerWorkItem.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
index 91ea752..fbae2a6 100644
--- a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
+++ b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
@@ -496,6 +496,12 @@ static uint64_t computeMIRComplexityScoreImpl(const MachineFunction &MF) {
// Add in the block count.
Score += 2 * MF.size();
+ const MachineRegisterInfo &MRI = MF.getRegInfo();
+ for (unsigned I = 0, E = MRI.getNumVirtRegs(); I != E; ++I) {
+ Register Reg = Register::index2VirtReg(I);
+ Score += MRI.getRegAllocationHints(Reg).second.size();
+ }
+
for (const MachineBasicBlock &MBB : MF) {
for (const MachineInstr &MI : MBB) {
const unsigned Opc = MI.getOpcode();