Code motion is an important global optimizing technology in a compiler. Here a new code motion algorithm is discussed, in which code motion (the elimination of common subexpression and the movement of loop-invariant computation, etc. )can be completed simply by data flow analysis without uncovering the loop structures embedded in the control flow graph, therefore it is a very efficient method.