next up previous contents
Next: Going parallel Up: Loop parallelization Previous: Identifying common instructions   Contents

A quick heuristic

Although I have not focused much on whether it is feasible to parallelize anything, I did insert a rough heuristic in the loop parallelizer.

We know how many common instructions we found, and we know how many instructions the loop code contains. So, if the number of common instructions is more than half of the instructions in the loop, we decide not to parallelize. Instead we call the sequence parallelizer to have the loop code parallelized if at all possible.

This heuristic works for now, but we will need something more sophisticated later. If some cost estimate is developed (it is also needed in the sequence parallelizer), it would be easy to ``plug in'' here too.