is there any plan to grow MIR a proper peephole optimization mechanism?
I recently wrote one for LLVM and their API would make something like: https://github.com/rust-lang/rust/issues/75144 trivial to implement.
I wouldn't know how that would look, can you give an example why that would be trivial with a peephole optimization mechanism?
a lot of them are modeled as pattern matching + code transformations
or fitzgen's peepmatic for cranelift https://github.com/fitzgen/peepmatic#example
yea, in rustc it would probably be implemented as a mir traversal which also remembers the shape of previous visited locations
for example here's the opt i added to llvm to fix an issue with