Make constmerge a two-pass algorithm so that it won't miss merging