4 ms·
Mem2reg works fine on variables whose addresses have not escaped. Compilers do extensive alias analysis anyway, because even given an oracle that says double* d
by JonChesterfield 3y ago
Mem2reg works fine on variables whose addresses have not escaped. Compilers do extensive alias analysis anyway, because even given an oracle that says double* does not alias long*, you still want to work out which double*s can alias.
Type based alias analysis is a hack from separate compilation using compilers on limited hardware resources. It should be dropped as an unnecessary compromise to language expressivity, not leaned into as a law of nature.
- sanxiyn 3y agoWithout pointer provenance, all addresses escape. Just cast integer to pointer. I agree strict aliasing is a relic of the past that should be abolished ASAP, but that's quite different from pointer provenance.
- jcranmer 3y ago> Mem2reg works fine on variables whose addresses have not escaped. The question of pointer provenance is really about trying to formalize a workable definition of "escape." This turns out to be far harder than it looks, because it turns out that converting a pointer to integer necessarily needs to be an escape, and all of a sudden, there are all sorts of hidden places that causes pointers to become integers that you never expected (such as storing a pointer in a stack variable, if memory is untyped).