Skip to content

Commit 5e15997

Browse files
authored
MachineFunctionPass: Clear properties before running function (#67962)
This ensures !isSSA checks in the function work if the input MIR happened to appear as SSA.
1 parent 1d959f9 commit 5e15997

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

llvm/lib/CodeGen/MachineFunctionPass.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ bool MachineFunctionPass::runOnFunction(Function &F) {
8888
MF.print(OS);
8989
}
9090

91+
MFProps.reset(ClearedProperties);
92+
9193
bool RV = runOnMachineFunction(MF);
9294

9395
if (ShouldEmitSizeRemarks) {
@@ -114,7 +116,6 @@ bool MachineFunctionPass::runOnFunction(Function &F) {
114116
}
115117

116118
MFProps.set(SetProperties);
117-
MFProps.reset(ClearedProperties);
118119

119120
// For --print-changed, print if the serialized MF has changed. Modes other
120121
// than quiet/verbose are unimplemented and treated the same as 'quiet'.

llvm/lib/CodeGen/RegisterCoalescer.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -4167,14 +4167,6 @@ bool RegisterCoalescer::runOnMachineFunction(MachineFunction &fn) {
41674167
else
41684168
JoinGlobalCopies = (EnableGlobalCopies == cl::BOU_TRUE);
41694169

4170-
// FIXME: MachineFunctionProperties cannot express the required pre-property
4171-
// no-SSA. When running a MIR testcase without any virtual register defs, the
4172-
// MIR parser assumes SSA. MachineFunctionPass::getClearedProperties is called
4173-
// after the pass is run, so the properties at this point say it's an SSA
4174-
// function. Forcibly clear it here so -verify-coalescing doesn't complain
4175-
// after multiple virtual register defs are introduced.
4176-
MRI->leaveSSA();
4177-
41784170
// If there are PHIs tracked by debug-info, they will need updating during
41794171
// coalescing. Build an index of those PHIs to ease updating.
41804172
SlotIndexes *Slots = LIS->getSlotIndexes();

0 commit comments

Comments
 (0)