The strtol folding is conditional on the second argument, endptr, being a constant null pointer. However, since the idiomatic use case is to pass the function the address of a local end pointer as endptr, this restriction prevents the folding from taking place in the common case when the pointer is known not to be null.
Not having been able to find a rationale for this decision in D45418 (only tests), this change enables the folding also for endptr that's known to be nonnull by having the folder store the address of the nul character in *endptr. It stops short of attempting to handle arbitrary pointers since I suspect the cases where nothing is known about the pointer are rare.
Tested on x86_64-linux.
(This patch will need to be rebased on top of D129224 once it's committed.)
enptr -> endptr