I'm working on a little #Uxntal optimisation algorithm that is fundamentally of little use, it's one of those "I can't help myself" things, but I think it is quite nice:

What it does is, where possible, eliminate stores and loads in an <addr> <store with keep> ... <load> sequence, regardless of the intervening sequence. So it disentangles the stack juggling needed to put the address at the top of the stack for the load from the other operations.

After that is done, I have another algorithm that can eliminate the store/load pairs altogether.

I'll explain more when I actually get it to work.

@wim_v12e I'm always looking to expand the list of peep-hole optimizations :) If you find a good pattern replacement for store with keep, I'm taking!
https://git.sr.ht/~rabbits/uxnlin/tree/main/item/src/assets.tal
@neauoire this one is not peep-hole, but I have a series of those as well, happy to share when I am confident it all works.
@wim_v12e ah! yes, I'd love to grow the list. That means everyone's programs get better when there's new peephole discoveries :) I'm also curious to see what you're working on with the load/store thing.
@neauoire Hopefully it won't be too long before I get it working, I'm keen to do a write-up.