aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2022-04-15 22:35:53 -0400
committerMatt Arsenault <Matthew.Arsenault@amd.com>2022-06-07 10:14:48 -0400
commitcc5a1b3dd9039d50f6b9caa679d60398f0cec65f (patch)
tree1181a5ad63acc0163e21f54b677554d1ade93b35 /llvm/tools/llvm-reduce/ReducerWorkItem.cpp
parentcfe516849907da762c40d7dea2b6c2256d264c48 (diff)
downloadllvm-cc5a1b3dd9039d50f6b9caa679d60398f0cec65f.zip
llvm-cc5a1b3dd9039d50f6b9caa679d60398f0cec65f.tar.gz
llvm-cc5a1b3dd9039d50f6b9caa679d60398f0cec65f.tar.bz2
llvm-reduce: Add cloning of target MachineFunctionInfo
MIR support is totally unusable for AMDGPU without this, since the set of reserved registers is set from fields here. Add a clone method to MachineFunctionInfo. This is a subtle variant of the copy constructor that is required if there are any MIR constructs that use pointers. Specifically, at minimum fields that reference MachineBasicBlocks or the MachineFunction need to be adjusted to the values in the new function.
Diffstat (limited to 'llvm/tools/llvm-reduce/ReducerWorkItem.cpp')
-rw-r--r--llvm/tools/llvm-reduce/ReducerWorkItem.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
index 7446522..7f05ea8 100644
--- a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
+++ b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
@@ -240,8 +240,6 @@ static std::unique_ptr<MachineFunction> cloneMF(MachineFunction *SrcMF,
// Remap the debug info frame index references.
DstMF->VariableDbgInfos = SrcMF->VariableDbgInfos;
- // FIXME: Need to clone MachineFunctionInfo, which may also depend on frame
- // index and block mapping.
// Clone virtual registers
for (unsigned I = 0, E = SrcMRI->getNumVirtRegs(); I != E; ++I) {
Register Reg = Register::index2VirtReg(I);
@@ -345,6 +343,11 @@ static std::unique_ptr<MachineFunction> cloneMF(MachineFunction *SrcMF,
DstMF->setDebugInstrNumberingCount(SrcMF->DebugInstrNumberingCount);
+ if (!DstMF->cloneInfoFrom(*SrcMF, Src2DstMBB))
+ report_fatal_error("target does not implement MachineFunctionInfo cloning");
+
+ DstMRI->freezeReservedRegs(*DstMF);
+
DstMF->verify(nullptr, "", /*AbortOnError=*/true);
return DstMF;
}