Optimize self-comparison of static constants.