Optimize patterns by evaling constraints as early as possible