Adding a high-pass filter before the compressor, set around 30-40Hz, can help clean up low-end spikes that might trigger the compressor, although this is not the main reason such a filter would be introduced. It's a practical move in general, especially since very low frequencies aren't always essential in most mixes. If you let the compressor work without low-filtering, it could overreact to those spikes and possibly affect the rest of the sound more than you'd like - that’s a new problem. The compressor's side chain filter (if available) would address this new one, but there's still a risk that some low spikes could slip through, causing issues down the line. Deciding whether to place the filter before or after the compressor depends on what works best for your setup.
Personally, I tend to skip the high-pass filter altogether. It's just not something I find absolutely necessary. If I were to use one, I'd place it before the compressor and set it at a low enough frequency (20-30-40 Hz) to not interfere with the musical style I'm working with and let the other effects process as much of the signal as possible. Just to eliminate accidental spikes that can create booming problems. From this perspective, a HPF can also be placed at the end of the chain, to remove accidental subsonic spikes, while processing the signal in any way up to that point. I am speaking for myself here anyway, not suggesting that this is the way to go. Others might find use cases that actually require using these filters. For instance, to cut some lows from a darker instrument, in which case it could be set at a higher frequency, and that would also justify placing it in front of the compressor, to eliminate the triggering problem. I tend to avoid introducing too much electronics though, especially filters, because they also twist signal phase and that can create other issues afterwards.