[llvm] 9444c2d - [GISel][NewPM] Note we always modify MIR in IRTranslator

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 16:01:23 PDT 2026


Author: Aiden Grossman
Date: 2026-08-18T16:01:18-07:00
New Revision: 9444c2d49a70a72537f560ba8afcd4282d604e20

URL: https://github.com/llvm/llvm-project/commit/9444c2d49a70a72537f560ba8afcd4282d604e20
DIFF: https://github.com/llvm/llvm-project/commit/9444c2d49a70a72537f560ba8afcd4282d604e20.diff

LOG: [GISel][NewPM] Note we always modify MIR in IRTranslator

It turns out IRTranslatorImpl::runOnMachineFunction always returns
false, so we would fail to invalidate some analyses (like
GISelCSEAnalysis) that we should have.

Test coverage will be in a future commit that also ports the Legalizer,
which asserts that we correctly preserve/invalidate GISelCSEAnalysis.

Reviewers: vikramRH, arsenm

Pull Request: https://github.com/llvm/llvm-project/pull/217045

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index a40e7f0610b40..8a4703c230e7f 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -4525,7 +4525,7 @@ PreservedAnalyses IRTranslatorPass::run(MachineFunction &MF,
   if (!MLLI)
     reportFatalUsageError(
         "LibcallLoweringModuleAnalysis must be available for IRTranslator");
-  bool Changed = Impl.runOnMachineFunction(
+  Impl.runOnMachineFunction(
       MF, [&]() { return MFAM.getResult<GISelCSEAnalysis>(MF).get(); },
       ShouldSkipOpts, [&]() { return &FAM.getResult<AAManager>(F); },
       [&]() { return &FAM.getResult<BranchProbabilityAnalysis>(F); },
@@ -4534,6 +4534,5 @@ PreservedAnalyses IRTranslatorPass::run(MachineFunction &MF,
       &MLLI->getLibcallLowering(Subtarget),
       &FAM.getResult<SSPLayoutAnalysis>(F));
 
-  return Changed ? getMachineFunctionPassPreservedAnalyses()
-                 : PreservedAnalyses::all();
+  return getMachineFunctionPassPreservedAnalyses();
 }


        


More information about the llvm-commits mailing list