before merge loopoptimize