Closed ezrosent closed 4 months ago
Done! I think these ones do saturate but in general peepholes may not. Also optimizations is a better description of what the goal is.
Looks like there's a failing test: loop_invariant::test_invariant_detect
I'll take a look
This change starts a basic peephole optimization files. Most moderately complex peepholes I've found rely on things like shifting operators, sign extensions, etc. None of those can be done at the bril level (but note that LLVM will take advantage of them with optimizations turned on!)
Still, these probably don't hurt. I've added in some rules for forwarding predicates for ifs. Let me know if I'm using contexts correctly here.