You may want to look at LICM, which in order to pull a call out of a loop has to prove that the call is independent of loop variables and other calls in the loop etc. Ciao, Duncan.