Right. For my input there is no nsw flag but I guess one could equally well require more assumes on %X e.g. that it is in interval [a,b] and for this range the shl does not overflow.
edit: Or maybe if those assumes were already present some other pass would already have set a nsw flag on on the shl.
Did some more experiments, trying to clean up the code and make it more generic.
Instead of only determining if X != 0 (which is clearly not sufficient) try to produce a value range for the variable and use that.