Since D141386 has changed the return value of !range from IUB to poison,
metadata !range shouldn't be preserved even if K dominates J.
If this patch was accepted, I plan to adjust metadata !nonnull as well.
BTW, I found that metadata !noundef is not handled in combineMetadata,
is this intentional?
Now, this case is combined into the most generic range. But I think it is unnecessary.
Before transforming, there are 4 cases:
If we don't combine them into the most generic range and just retain !0.
The only difference is case 4. We transform returning a poison value to returning a well-defined value. But it is safe.
In summary, I think we don't need to combine them into the most generic range for this case, just retaining it is enough.
Do you agree with me @nikic?