This avoids the danger shown in issue #60906. There were no regression tests for these patterns, so these potential failures have been around for a long time.
We freeze the condition and preserve the optimization because getting rid of a div/rem is always a big win.
Here are a couple of examples that can be corrected by freezing the condition:
https://alive2.llvm.org/ce/z/sXHTTC
Should we avoid introducing freeze if MatchIsOpZero is false and the op is udiv/urem?