Allow local optimizer to return a Dict that give variable to replaces.

Make PatternSub use that feature to lower optimizer time by tracking
less frequent node. This allow to save 85s on 317s in optimizer time.