How exactly does a compiler just remove loops ?