Think of this way;
If your opponent + situation tells
you he's only doing this with KK/AA, fold.
If your opponent + situation tells you his range is QQ+ and AK, you're in a better situations,
If your opponent + situation tells you his range includes AQ and JJ and maybe slightly lower, you're in a good situation to get it in.
If your opponent might be doing this with AJ- and mid pairs and down, you're so far ahead that you can consider flatting because if you flop top pair you may have him dominated and he'll pay you off postflop.
This is all based on 100bb stacks; if you're deeper then the all-in preflop range should be much tighter. If stacks are short then you're probably already committed.