[llvm] [MachineLICM] Only mark live-ins as non-invariant if defined in loop (PR #191755)

Yuyang Zhang via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 00:09:18 PDT 2026


================
@@ -596,20 +596,37 @@ void MachineLICMImpl::HoistRegionPostRA(MachineLoop *CurLoop) {
   SmallVector<CandidateInfo, 32> Candidates;
   SmallDenseSet<int> StoredFIs;
 
-  // Walk the entire region, count number of defs for each register, and
-  // collect potential LICM candidates.
+  // First pass: collect all register units defined within the loop.
+  BitVector LoopRUDefs(NumRegUnits);
+  for (MachineBasicBlock *BB : CurLoop->getBlocks()) {
+    for (MachineInstr &MI : *BB) {
----------------
yuyzhang512 wrote:

Done — factored the def collection into `addRegUnitDefs`.

https://github.com/llvm/llvm-project/pull/191755


More information about the llvm-commits mailing list