Fix crash du to opt that introduce cycle in the graph

NEWS.txt
Fix crash caused by an optimization that introduce cycle in the graph (Frederic Bastien, reported by Axel Davy)
There is the MergeFeature that detect possible replacement and store them. Then the MergeOptimizer try them. In between, the graph can change. So this is why I add this new check, to know if the replacement is still valid. In fact, I think I don't need to check for node.op != candidate.op, as the apply node ops shouldn't have changed. I'll try that, add tests and check for scan.