[SCEVExpander] Also apply 0/poison-free expansion to URem. (#243898)
Also apply SAfeUDivMode to expanding URem in SCEVExpander, which
triggers UB on zero or poison, similar to UDiv.
The code for expanding a safe divisor is moved to a helper.
PR: https://github.com/llvm/llvm-project/pull/243898