When I have muscle soreness after training, I generally take a light OTC painkiller/anti-inflammatory. To me, it just makes sense to not be in pain if you don't have to be. I have had friends tell me that it's counter-productive, that if the body doesn't feel pain, it won't register that muscle development is necessary and therefore the muscle development won't be as much. To me, that feels somewhere in between bro science ("No pain, no gain!") and folk magic ("If the muscle doesn't comprehend pain, how can it every truly grow as a muscle?"), but I could see a few possibilities, ranging from that there is some general property of painkillers that discourages muscle gain not related to the actual feeling of pain to that the increased stiffness and soreness results in additional exercise as you push your way through your regular day and recruit other muscles to move around.
Moderate or occasional doses are probably fine, but further research is necessary.
If a negative relationship between NSAIDS and gains exits, then it is probably dose dependent.
This study from Krentz and collegaues concludes:
We conclude that a moderate dose of ibuprofen ingested after repeated resistance training sessions does not impair muscle hypertrophy or strength and does not affect ratings of muscle soreness.
However, this study from Lilja and colleagues concluded:
Maximal over-the-counter doses of ibuprofen attenuate strength and muscle hypertrophic adaptations to 8 weeks of resistance training in young adults. Thus, young individuals using resistance training to maximize muscle growth or strength should avoid excessive intake of anti-inflammatory drugs.
The first study used a 400 mg dose of Ibuprofen immediately after training one arm, then the next day subjects trained the other arm and did not take any Ibuprofen, and no significant difference between arms was observed. In the second study, one group was given 1200 mg of Ibuprofen daily and compared to a placebo group, with the placebo group seeing a statistically significant increase in quadriceps strength and hypertrophy when compared to the NSAID group. We must note that the first study did not have a group that did not take any Ibuprofen, as the authors opted for a cross-over study design where each subject acts as their own control (meaning everyone took some Ibuprofen).
However, more research is necessary. This systematic review examined the state of research on this topic, and left us with a lot of question marks (literally) on Ibuprofen use:
In this context, a question mark indicates "no significant change". So the conclusion here is pointing toward something like "you're probably fine", but further research is warranted. However, they do note a positive relationship between Ibuprofen use and muscle mass/performance in elderly subjects.
My recommendation would be keep NSAID use to as little as possible, and instead manage inflammation and pain through responsible exercise and load selection during training, since there are other well documented complications with chronic high dose NSAID use, such as gastric ulcers.