I’d say your bike needs to be appropriate to what you want to do in order to let you reach your potential. For example a DH bike mustn’t break, and an XC bike ideally should be fairly light – you’re not going to do as well as you should be able to do on a 37lb trail monster.
It’s a sliding scale. Going from a 37lb bike to a 25lb bike will make a massive difference to your XC racing – going from 25 to 22 won’t make as much, and going from 22 to 21 will make hardly any at all 🙂
Riding position is also important for XC. So a 25lb racy hardtail will be quicker than a 25lb trail bike – usually.. but of course that could depend on the course 🙂