I suppose it depends on a few different factors.
If the martyr had perfect contrition, which “arises from a love by which God is loved above all else…Such contrition remits venial sins; it also obtains forgiveness of mortal sins if it includes the firm resolution to have recourse to sacramental confession as soon as possible” (CCC 1452). In the martyr’s case, there would be no opportunity for sacramental confession, so perfect contrition would obtain forgiveness.
On the other hand, we know that “if I hand over my body to be burned, but do not have love, I gain nothing” (1 Cor 13:3). So if the martyr died a martyr’s death without doing so out of love, the martyrdom itself would not profit the martyr.
So there isn’t really an absolute yes or no to the question. It depends.