I see no reason for any sort of AI to be applied here.
There's an interesting guide on converting an interpreter into a static binary translator: https://gtoal.com/sbt/
It would be great to see this expanded into a JIT compiler (using a generic translated code management/caching and optimization framework).