RFR(S): 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland.westrelin at oracle.com
Thu Apr 30 11:30:45 UTC 2015
> Okay. Thank you for explaining. You are right that we can't remove new predicates (null checks, etc).
> Changes looks good.
Thanks for the review and discussion.
> On 4/29/15 2:26 AM, Roland Westrelin wrote:
>> Hi Vladimir,
>> Thanks for looking at this.
>>> Can we remove predicates when loop is optimized out?
>>> What code eliminates the loop?
>> For the test case, the loop is found empty by IdealLoopTree::policy_do_remove_empty_loop() and the CountedLoopNode is effectively removed by RegionNode::Ideal() because it has a single input. For the crash in mb/jvm/compiler/InterfaceCalls/testAC2, the loop is also removed by RegionNode::Ideal() but I don’t know if it’s because the loop was empty or for another reason (I assume the backbranch could be removed also because the loop has a single iteration).
>> We can’t remove all predicates without risking incorrect execution, right? The loop could for instance only perform a null check. Loop predication moves the null check out of the loop. The loop becomes empty so it goes away. But the null check can’t go away because the method is still supposed to throw an NPE if the null check fails.
>> We could remove the predicates that GraphKit::add_predicate() adds and that will eventually go away (the ones that test an opaque node). That doesn’t help split_if because PhaseIdealLoop::find_predicate() could still find a predicate like the null check above. So we could remove the predicates that test on an opaque node when the loop goes dead, then change split_if so it looks not for any predicates but only for the predicates that test on an opaque node. But that doesn’t help either because AFAIU, split_if can be run after the loop optimizations are over and Opaque1Node::Identity() has removed those predicates.
>>> On 4/28/15 1:38 AM, Roland Westrelin wrote:
>>>> See test case: the loop is unswitched, then the loop bodies become empty so the loops are optimized out. The split if optimization then finds predicates it doesn’t expect on both branches of the unswitched loop test.
More information about the hotspot-compiler-dev