[llvm-branch-commits] [llvm] RegAlloc: Fix verifier error after failed allocation (PR #119690)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Dec 16 21:53:26 PST 2024
================
@@ -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
More information about the llvm-branch-commits
mailing list