RFR(S): 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected

Roland Westrelin roland.westrelin at oracle.com
Wed Apr 29 09:26:03 UTC 2015

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.


> Vladimir
> On 4/28/15 1:38 AM, Roland Westrelin wrote:
>> http://cr.openjdk.java.net/~roland/8078426/webrev.00/
>> 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.
>> Roland.

More information about the hotspot-compiler-dev mailing list