The IRS knows the attitude (after all, that is what we fly by) and it also has a good idea about the airspeed.** And the FMC knows the weight. From this, the correct stall attitude can be calculated with reasonable precision.
Well, not really...but
most of the time. This statement presumes no vertical up/downdrafts...which probably has a lot to do with this accident. Might have helped with AF447, but don't see how that would help in this case, in fact keeping it within a prescribed pitch attitude could make the situation worse.