On Fri, 8 Apr 2022 01:59:10 GMT, Quan Anh Mai <d...@openjdk.java.net> wrote:
> Personally, I think the optimisation for `div < 0` should be handled by the > mid-end optimiser, which will not only give us the advantages of dead code > elimination, but also global code motion. I would suggest the backend only > doing `xorl rdx, rdx; divl $div$$Register` and the optimisation for `div < 0` > will be implemented as a part of JDK-8282365. What do you think? I agree that we can do more optimizations with constants as JDK-8282365 suggested. But I think we should proceed with current changes as they are after fixing remaining issues. I assume that you are talking about case when `divisor` is constant (or both). Because if it is not, IR optimization will not help - we don't profile arithmetic values so we can't generate uncommon trap path without some profiling information. ------------- PR: https://git.openjdk.java.net/jdk/pull/7572