================ @@ -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. ---------------- arsenm wrote:
It depends. There are some that use reserved physical registers, and some that don't. The verifier rules are different. Reserved registers get very little checking but you're not allowed to set most of these operand flags when using them 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