A basic implementation of an MLIR pass based on the paper "Simplfying Dependent Reductions in the Polyhedral Model" by Yang et al. This isn't a fully general/robust pass but written for pedagogical purposes. I've only tested it on two examples: a simple prefix sum and a depth-3 loopnest reduction.
I've written a post attempting to explain the paper in some detail here.
You can run the pass on the prefix sum example like this.
bazel build //:optimizer
bazel-bin/optimizer tests/prefix_sum_test.mlir -p simplify-dependent-reduce -o output.mlir