[15] RFR(M): 8240227: Loop predicates should be copied to unswitched loops

Christian Hagedorn christian.hagedorn at oracle.com
Tue Mar 17 15:25:36 UTC 2020


Hi Roland

On 17.03.20 14:13, Roland Westrelin wrote:
> 
>> Yes, there are cases where the split-if optimization moves a store out
>> of a loop in PhaseIdealLoop::try_move_store_before_loop() which is an
>> input to such a load with a control input from a range check predicate.
>> As a result, the newly created loop nest in
>> PhaseIdealLoop::build_loop_late() does no longer contain the load node
>> when applying the loop unswitch optimization. I added an additional
>> comment about it in webrev.01.
> 
> What would happen if you were to clone a predicate with no use in the
> loop? Wouldn't that be harmless? Actually, couldn't a predicate with no
> use (that are always cloned) be one of those?

It should be harmless and still be correct. As we have discussed 
offline, it probably is not worth the risk of skipping on some 
predicates with data uses that are not part of the loop as it it does 
not occur very often. And since we are already copying predicates 
without data uses, I think we should just clone all range check 
predicates and stay on the safe side.

I updated my webrev to just clone all range check predicates:
http://cr.openjdk.java.net/~chagedorn/8240227/webrev.02/

Best regards,
Christian




More information about the hotspot-compiler-dev mailing list