[Core] Optimize NthOrder promotion checker.
Merge pull request #1967 from stloyd/bugfix/nth_order

[Core] Optimize NthOrder promotion checker.