================
@@ -161,6 +163,40 @@ void RegAllocBase::postOptimization() {
   DeadRemats.clear();
 }
 
+void RegAllocBase::cleanupFailedVRegs() {
+  SmallSet<Register, 8> JunkRegs;
+
+  for (Register FailedReg : FailedVRegs) {
+    JunkRegs.insert(FailedReg);
+
+    MCRegister PhysReg = VRM->getPhys(FailedReg);
+    LiveInterval &FailedInterval = LIS->getInterval(FailedReg);
+
+    // The liveness information for the failed register and anything 
interfering
+    // with the physical register we arbitrarily chose is junk and needs to be
+    // deleted.
+    for (MCRegUnitIterator Units(PhysReg, TRI); Units.isValid(); ++Units) {
+      LiveIntervalUnion::Query &Q = Matrix->query(FailedInterval, *Units);
+      for (const LiveInterval *InterferingReg : Q.interferingVRegs())
+        JunkRegs.insert(InterferingReg->reg());
+    }
+  }
+
+  // TODO: Probably need to set undef on any physreg uses not associated with
+  // a virtual register.
----------------
ilovepi wrote:

Aren't there places where we lower things/expand pseudos using physical regs 
before RegAlloc? We do some weird things for stuff like TLSDESC  where ABI 
dictates we use particular registers. It's not a problem in this patch, but I 
want to understand better if we're doing things we shouldn't in the various 
lowerings and should consider addressing that.

https://github.com/llvm/llvm-project/pull/119690
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to