On Tue, 24 Apr 2018, Michael Matz wrote: > What is lost here (it wasn't explicit before, but is the case and must > continue to work) is that function calls and returns count as needing the > observable value in the specified register (function calls also count as > setters of them). I think that should be made more explicit.
It's no different from a normal variable in global scope. If the compiler sees gvar = 0; bar(); gvar = 1; it can delete the first store iff it can prove that it's dead ('bar' does not read it), gvar being a register variable making no difference. So I don't think it needs additional clarification. > Especially > because you make it explicit that the register remains available for > allocation (where it before said it's not) we need to make sure that > everybody understand that it's only during tiny windows like: > > regvar = ... > ... code not accessing regvar and containing no calls ... > regvar = ... No, the first store is not needed. If the regvar is dead, the register is freely allocatable (if not dead, it's allocatable at a cost of 1 spill). > The return of functions also must remain making the regvar setter live, to > give us the important parts of the former "stores aren't deleted even if > appearing dead" guarantee. This also follows from the variable being a global variable in the first place. Alexander