[llvm] 02d25c8 - GlobalISel: Remove block insertion legalizer check

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 18:04:55 PDT 2023


Author: Matt Arsenault
Date: 2023-06-09T21:04:37-04:00
New Revision: 02d25c82b8b54a3c3f3791c700c7f4192554a95e

URL: https://github.com/llvm/llvm-project/commit/02d25c82b8b54a3c3f3791c700c7f4192554a95e
DIFF: https://github.com/llvm/llvm-project/commit/02d25c82b8b54a3c3f3791c700c7f4192554a95e.diff

LOG: GlobalISel: Remove block insertion legalizer check

This report was broken. The passed null block would crash in the
remark constructor.

I have a patch which will introduce a new block, and it seems to work
fine. It doesn't require legalizing any instructions in the new block,
so it's possible those will be missed.

Added: 
    

Modified: 
    llvm/lib/CodeGen/GlobalISel/Legalizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp b/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
index ee6aaa1a1a187..aecbe0b7604c0 100644
--- a/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
@@ -319,8 +319,6 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
       getAnalysis<GISelCSEAnalysisWrapperPass>().getCSEWrapper();
   MachineOptimizationRemarkEmitter MORE(MF, /*MBFI=*/nullptr);
 
-  const size_t NumBlocks = MF.size();
-
   std::unique_ptr<MachineIRBuilder> MIRBuilder;
   GISelCSEInfo *CSEInfo = nullptr;
   bool EnableCSE = EnableCSEInLegalizer.getNumOccurrences()
@@ -355,16 +353,6 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
                        "unable to legalize instruction", *Result.FailedOn);
     return false;
   }
-  // For now don't support if new blocks are inserted - we would need to fix the
-  // outer loop for that.
-  if (MF.size() != NumBlocks) {
-    MachineOptimizationRemarkMissed R("gisel-legalize", "GISelFailure",
-                                      MF.getFunction().getSubprogram(),
-                                      /*MBB=*/nullptr);
-    R << "inserting blocks is not supported yet";
-    reportGISelFailure(MF, TPC, MORE, R);
-    return false;
-  }
 
   if (LocObserver.getNumLostDebugLocs()) {
     MachineOptimizationRemarkMissed R("gisel-legalize", "LostDebugLoc",


        


More information about the llvm-commits mailing list