It seems to me that a compiler spilling logical registers solely based on the number of logical registers is very suboptimal -- unless the CPU can ignore spill instructions when a sufficient number of physical registers are available.
You are mistaken. Spilling is dependent on the number of physical registers. When the compiler uses up all of the available physical registers, it must spill a physical register to get another available physical register. Nested loops with arrays can use a lot of registers.