Presumably this would need some advancements in formal verification to make sure the results are correct.

But ignoring that for now, LLMs can already do better than modern compilers when it comes to optimizing code.

It has become a neat way of finding opportunities to implement in a compiler.

Give the LLM a compiler generated piece of assembly and it will sometimes spit out a slightly better version. Then you try and figure out if it's possible to implement it in the compiler. This works really well for blind spots in compilers like generating good vectorized code.