[llvm] 5e15997 - MachineFunctionPass: Clear properties before running function (#67962)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 15:11:51 PDT 2023


Author: Matt Arsenault
Date: 2023-10-05T15:11:47-07:00
New Revision: 5e159972917fb7d02347f98d7431f1d02bee33b6

URL: https://github.com/llvm/llvm-project/commit/5e159972917fb7d02347f98d7431f1d02bee33b6
DIFF: https://github.com/llvm/llvm-project/commit/5e159972917fb7d02347f98d7431f1d02bee33b6.diff

LOG: MachineFunctionPass: Clear properties before running function (#67962)

This ensures !isSSA checks in the function work if the input MIR
happened to appear as SSA.

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineFunctionPass.cpp
    llvm/lib/CodeGen/RegisterCoalescer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineFunctionPass.cpp b/llvm/lib/CodeGen/MachineFunctionPass.cpp
index 3a1e1720be9c627..d57a912f418b728 100644
--- a/llvm/lib/CodeGen/MachineFunctionPass.cpp
+++ b/llvm/lib/CodeGen/MachineFunctionPass.cpp
@@ -88,6 +88,8 @@ bool MachineFunctionPass::runOnFunction(Function &F) {
     MF.print(OS);
   }
 
+  MFProps.reset(ClearedProperties);
+
   bool RV = runOnMachineFunction(MF);
 
   if (ShouldEmitSizeRemarks) {
@@ -114,7 +116,6 @@ bool MachineFunctionPass::runOnFunction(Function &F) {
   }
 
   MFProps.set(SetProperties);
-  MFProps.reset(ClearedProperties);
 
   // For --print-changed, print if the serialized MF has changed. Modes other
   // than quiet/verbose are unimplemented and treated the same as 'quiet'.

diff  --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp
index 68c5fee85973d55..7e5ce300370c92b 100644
--- a/llvm/lib/CodeGen/RegisterCoalescer.cpp
+++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp
@@ -4167,14 +4167,6 @@ bool RegisterCoalescer::runOnMachineFunction(MachineFunction &fn) {
   else
     JoinGlobalCopies = (EnableGlobalCopies == cl::BOU_TRUE);
 
-  // FIXME: MachineFunctionProperties cannot express the required pre-property
-  // no-SSA. When running a MIR testcase without any virtual register defs, the
-  // MIR parser assumes SSA. MachineFunctionPass::getClearedProperties is called
-  // after the pass is run, so the properties at this point say it's an SSA
-  // function.  Forcibly clear it here so -verify-coalescing doesn't complain
-  // after multiple virtual register defs are introduced.
-  MRI->leaveSSA();
-
   // If there are PHIs tracked by debug-info, they will need updating during
   // coalescing. Build an index of those PHIs to ease updating.
   SlotIndexes *Slots = LIS->getSlotIndexes();


        


More information about the llvm-commits mailing list