From 7c2db66632486c7c460779843d60477a06ded462 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Mon, 18 Apr 2022 22:19:57 -0400 Subject: llvm-reduce: Support multiple MachineFunctions The current testcase I'm trying to reduce only reproduces with IPRA enabled and requires handling multiple functions. The only real difference vs. the IR is the extra indirect to look for the underlying MachineFunction, so treat the ReduceWorkItem as the module instead of the function. The ugliest piece of this is really the ugliness of MachineModuleInfo. It not only tracks actual module state, but has a number of transient fields used for isel and/or the asm printer. These shouldn't do any harm for the use here, though they should be separated out. --- llvm/lib/CodeGen/MachineModuleInfo.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp') diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp index 92e7332..7dee06d 100644 --- a/llvm/lib/CodeGen/MachineModuleInfo.cpp +++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp @@ -141,6 +141,13 @@ void MachineModuleInfo::deleteMachineFunctionFor(Function &F) { LastResult = nullptr; } +void MachineModuleInfo::insertFunction(const Function &F, + std::unique_ptr &&MF) { + auto I = MachineFunctions.insert(std::make_pair(&F, std::move(MF))); + assert(I.second && "machine function already mapped"); + (void)I; +} + namespace { /// This pass frees the MachineFunction object associated with a Function. -- cgit v1.1