Skip to content

Remove duplicate branches. #172

Open
wants to merge 2 commits into from

1 participant

@Blei
llvm-dcpu16 member
Blei commented May 15, 2012

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).

@ghost
ghost commented May 15, 2012

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.

@Blei
llvm-dcpu16 member
Blei commented May 15, 2012

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.

@ghost
ghost commented May 16, 2012

BUT you can pull this request if you want. (As long as it doesn't introduce heavy bugs ... like our 16bit char change) ;)

Blei added some commits May 15, 2012
@Blei Blei Remove duplicate branches.
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.
38475c2
@Blei Blei Rework hacky loop handling. 4869b34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.