This is called code sinking and AFAIK this is implemented in the 4.x series. You can also look at the code factoring branch that was being merged into 4.2. > Does gcc/g++ have what I think is called "common tail elimination"? > If a function does: step a, step b, step c, return val; in more than > one place, will the common code be pulled out and branched to in > order to reduce the size of the code? This may be contrary to most > optimizations since it introduces a branch which costs time but the > benefit is smaller code size. > > Thanks, > Perry > ---- Ramana Radhakrishnan GNU Tools Codito Technologies