Stream: t-compiler/wg-mir-opt

Topic: peephole opts in mir

Xavier Denis (Aug 07 2020 at 12:40, on Zulip):

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: trivial to implement.

oli (Aug 07 2020 at 13:26, on Zulip):

I wouldn't know how that would look, can you give an example why that would be trivial with a peephole optimization mechanism?

lqd (Aug 07 2020 at 13:31, on Zulip):

a lot of them are modeled as pattern matching + code transformations

lqd (Aug 07 2020 at 13:31, on Zulip):

like say,

lqd (Aug 07 2020 at 13:32, on Zulip):

or fitzgen's peepmatic for cranelift

Xavier Denis (Aug 09 2020 at 22:28, on Zulip):

yea, in rustc it would probably be implemented as a mir traversal which also remembers the shape of previous visited locations

Xavier Denis (Aug 09 2020 at 22:29, on Zulip):

for example here's the opt i added to llvm to fix an issue with split_at

Last update: Sep 28 2020 at 16:15UTC