The DCPU16 backend can generate duplicate branches when generating code
for == comparisons followed by >= or <= comparisons. See the test and
the new optimization pass for details.
This fixes the duplicate IFE instructions reported by #168.
I'm not sure if this is the correct approach or if some easier or more general method
is available. This code will have to be rewritten when we decompose the BRCC instructions
into "real" instructions (#141).
mhh As a work around it's okay for now. But I don't think that we should write custom passes for every kind of optimization (okay, it's our first pass for now). We should definitly try to simplify this when we have #141.
Yeah, I think so too. I will not mind at all if this will not be merged. I guess it was mostly an exercise to see how such a pass could work, a "real" solution would be much nicer.
BUT you can pull this request if you want. (As long as it doesn't introduce heavy bugs ... like our 16bit char change) ;)
Remove duplicate branches.
Rework hacky loop handling.