I ask for salary before I even apply at all. Anecdotally, I see a huge range of salaries for the same position - the high end offers 1.5-2x what I would consider "normal" salary for a mediocre applicant, and the low end (about 50% of all openings) is comically low. I always assume they're just fishing for very clueless people, but regardless it would be a huge waste of my time to interview these. I stop responding to 90% of employers purely based on unacceptably low salary range.
Companies that pay a high salary are not going to be mad that you asked. It's a great selling point for them. Of course they want to brag to you about how they pay a lot more than other people.
If they get mad that you ask about salary, it's almost certainly very underpaid. So no big loss.
However, they rarely get mad, and simply asking about compensation is not going to turn you from a yes to a no, unless maybe you're applying to a very cultish non-profit where people are expected to do very hard, skilled work for minimum wage. At most they'll dodge with something like "well it depends on experience/how you do" which is why you should ask them for their range, not what you would get. It's also best to ask as early as possible. The further into the interview you go, the more they know about you, and it can be used to adjust the top end of the range down. But early on they are forced to give a general range because for all they know you could be a great candidate that would be scared off by a lowball.