On Mon, 17 Feb 2025 10:36:52 GMT, Emanuel Peter <epe...@openjdk.org> wrote:

> I suppose we could write an optimization that can hoist out loop independent 
> if-diamonds out of a loop. If the condition and all phi inputs are loop 
> invariant, you could just cut the diamond out of the loop, and paste it 
> before the loop entry.

Right. But, it would likely not optimize as well. The new optimization will 
possibly have heuristics to limit complexity so could be limited. The diamond 
could be transformed to something else by some other optimization before it 
gets a chance to get hoisted. There are likely other optimizations that apply 
to floating nodes that would still not apply: for instance, `MinL`/`MaxL` can 
be split thru phi even if the `min` call is not right after the merge point. 
With branches that's not true. Also, with more compexity comes more bugs.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20098#issuecomment-2662733218

Reply via email to