> I'm talking about having a compiler which could produce more optimal code in any given case, or most given cases
Funny coincidence, that's exactly what the vast majority of compiler code is for, with tens (or hundreds) of thousands of man-years of work spent on that.