RFR(M): 8212610: Fix handling of memory in PhaseIdealLoop::clone_loop_predicates()

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Oct 18 16:43:01 UTC 2018


In what case we will not have memory Phi when there is region for cloned predicate? I thought it was always created. And 
your new created Phi has the same input (mem) on all branches - would not it be optimized out later?

Why you removed is_Proj() from assert() in second part of changes?

Thanks,
Vladimir

On 10/17/18 8:56 AM, Roland Westrelin wrote:
> 
> http://cr.openjdk.java.net/~roland/8212610/webrev.00/
> 
> I had previously sent this as part of 8212243.
> 
> We have:
> 
> Predicate 1
> ..
> Predicate n
> 
> profile predicate 1
> ..
> profile predicate n
> 
> loop head
> 
> Shenandoah write barriers produce memory, can be hoisted out of loop but
> can also depend on some predicate so may end up with:
> 
> Predicate 1
> ..
> Predicate n
> 
> profile predicate 1
> ..
> write barrier
> ...
> profile predicate n
> 
> loop head
> 
> In that case, all predicates branch to a region that dominates the
> uncommon trap call. Same is true for profile predicates. Because of the
> write barrier, the region for profile predicates has a memory phi to
> merge memory state before the barrier and after the barrier. Now when
> clone_loop_predicates() is called:
> 
> Predicate 1
> ..
> Predicate n
> 
> profile predicate 1
> ..
> write barrier
> ...
> profile predicate n
> 
> cloned predicate
> 
> cloned profile predicate
> 
> loop head
> 
> the cloned predicate branches to the region shared by all
> predicates. Same goes for the cloned profile predicate and the profile
> predicates. The memory state for the cloned predicate should be the one
> following the barrier but after cloning it's the one from the predicate
> n, before the barrier. That memory state needs to be adjusted.
> 
> Roland.
> 


More information about the hotspot-compiler-dev mailing list