▲ | gpderetta 4 days ago | ||||||||||||||||
I didn't claim that. What I mean is that if a pointer escapes into an inlined function and no further, it will still prevent further optimizations if we apply your rule that only non-escaping locals don't get addresses. The main benefit of inlining is that it is effectively a simple way to do interprocedurally optimizations. I.e.
By your rules, optimizing bar to return the constant 1 would not be allowed. | |||||||||||||||||
▲ | pizlonator 4 days ago | parent [-] | ||||||||||||||||
I think you’re applying a very strange strawman definition to “nonescaping”. It’s certainly not the definition I would pick. The right definition is probably something like: - pointers that come out of the outside world (syscalls) are escaped. They are just integers. - pointers to locals have provenance. They point to an abstract location. It is up to the implementation to decide when the location gets an integer value (is in an actual address) and what that value is. The implementation must do this no later than when the pointer to the local escapes. - pointer values passed to the outside world (syscalls) escape. - pointer values stored in escaped memory also escape, transitively That’s one possible definition that turns the UB into implementation defined behavior. I’m sure there are others | |||||||||||||||||
|