If you plan to implement an optimization, I recommend a pointer propagation. This is very simple and still lots of optimizers ignore it. For example,
mem += 3;
while (mem[0]) { mem += 1; mem[0] -= 1; mem += 1; }
mem -= 4;
mem[0] = 0;
becomes: while (mem[3]) { mem[1] -= 1; mem += 2; }
mem[-1] = 0;
mem -= 1; /* you can safely ignore this at the end of file */
where every relative memory access has been adjusted. Since it only affects the relative memory access, it is safe to apply the optimization to unbalanced loops as long as you keep the stride (a net pointer adjustment) at the end of the loop body. ++++++++++[>++++++++<-]>--. N
-----. I
------. C
++. E
<++++++[>------<-]>. !Shame on me for using Visual Studio. I turned to pure Linux/Mac development environments in recent years.
Then try and see if it's faster than this one - http://mazonka.com/brainf/bff4.c
See BrainF.cpp in particular.
It's a decent first illustration of the great level of abstraction LLVM offers.