RFR: 8263303: C2 compilation fails with assert(found_sfpt) failed: no node in loop that's not input to safepoint [v2]

Roland Westrelin roland at openjdk.java.net
Wed Jun 9 16:05:16 UTC 2021


On Wed, 9 Jun 2021 15:32:44 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   remove useless line from test
>
> Yes, we can't assume that all node in outer loop are referenced by Safepoint node. SP nodes reference only live values in current BC. In the test case it is value 'v'. After constant fold `v' become 0 and that is what SF should see (MulNode::Value() optimizes multiplication by 0). array[i] load should be dead at this point since nothing should be referencing it (except GC barriers, may be).
> 
> And I don't get how array[i] is moved from inner loop - it depends on `i` - loop's index.

Thanks for looking at this @vnkozlov 

> Yes, we can't assume that all node in outer loop are referenced by Safepoint node. SP nodes reference only live values in current BC. In the test case it is value 'v'. After constant fold `v' become 0 and that is what SF should see (MulNode::Value() optimizes multiplication by 0). array[i] load should be dead at this point since nothing should be referencing it (except GC barriers, may be).

The test case has: return v + array[i-1] + f;
array[i-1] is after i is incremented so commons with array[i] in the loop body. That keeps the array[i] load alive.

> And I don't get how array[i] is moved from inner loop - it depends on `i` - loop's index.

It's sunk out of loop because it only has uses out of loop. One of the uses is still indirectly the safepoint at the time sinking happens so it's pinned in the outer loop.

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

PR: https://git.openjdk.java.net/jdk/pull/4278


More information about the hotspot-compiler-dev mailing list