[llvm] a3f1491 - [nfc][mlgo][regalloc] 'hasPreferredPhys' out of feature components

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 31 19:01:51 PST 2022


Author: Mircea Trofin
Date: 2022-01-31T18:59:47-08:00
New Revision: a3f149184913c7ff8d855bfd3a9bf519b2d74e4b

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

LOG: [nfc][mlgo][regalloc] 'hasPreferredPhys' out of feature components

It isn't cacheable, it can be updated by other events than live interval
resizing.

Added: 
    

Modified: 
    llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp b/llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
index 4e69b9ed82ea..33782c755eb0 100644
--- a/llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
+++ b/llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
@@ -230,7 +230,6 @@ struct LIFeatureComponents {
   double HintWeights = 0.0;
   int64_t NrDefsAndUses = 0;
   float HottestBlockFreq = 0.0;
-  bool HasPreferredReg = false;
   bool IsRemat = false;
 };
 
@@ -692,7 +691,6 @@ MLEvictAdvisor::getLIFeatureComponents(const LiveInterval &LI) const {
   LIFeatureComponents Ret;
   SmallPtrSet<MachineInstr *, 8> Visited;
   const TargetRegisterInfo &TRI = *MF.getSubtarget().getRegisterInfo();
-  Ret.HasPreferredReg = VRM->hasPreferredPhys(LI.reg());
 
   for (MachineRegisterInfo::reg_instr_nodbg_iterator
            I = MRI->reg_instr_nodbg_begin(LI.reg()),
@@ -772,7 +770,7 @@ void MLEvictAdvisor::extractFeatures(
     if (LI.endIndex() > EndSI)
       EndSI = LI.endIndex();
     const LIFeatureComponents LIFC = getLIFeatureComponents(LI);
-    NrBrokenHints += LIFC.HasPreferredReg;
+    NrBrokenHints += VRM->hasPreferredPhys(LI.reg());
 
     NrDefsAndUses += LIFC.NrDefsAndUses;
     HottestBlockFreq = std::max(HottestBlockFreq, LIFC.HottestBlockFreq);


        


More information about the llvm-commits mailing list