RFR(XS): 8229450: C2 compilation fails with assert(found_sfpt) failed

Tobias Hartmann tobias.hartmann at oracle.com
Fri Aug 30 07:38:19 UTC 2019

On 29.08.19 08:41, Liu Xin wrote:
> - Did you compare the output of TraceLoopOpts?
> yes. I did compare them. they are very same, right? 

Yes, overall loop layout looks the same.

> TestMe.java
> Loop: N0/N0  has_call has_sfpt
>   Loop: N354/N353  limit_check sfpts={ 356 }
>     Loop: N355/N216  limit_check counted [0,4),+1 (-1 iters)  has_sfpt strip_mined
>   Loop: N364/N362  limit_check counted [int,0),-1 (-1 iters)  has_call has_sfpt
> Replay TraceLoopOpts
> Loop: N0/N0  has_call has_sfpt
>   Loop: N681/N680  limit_check sfpts={ 683 }
>     Loop: N682/N366  limit_check counted [0,4),+1 (-1 iters)  has_sfpt strip_mined
>   Loop: N691/N689  limit_check counted [int,0),-1 (-1 iters)  has_call has_sfpt
> One thing is beyond my understanding.  According to the inline tree of replay, it should have yet
> another loop but I can't find it!
> This loop should appear after the reverse loop 'Loop: N691/N689  limit_check counted [int,0),-1 (-1
> iters)' 
> https://github.com/amzn/ion-java/blob/0873d5c1429a3bf6365d56ae2ae8461bd3865289/src/com/amazon/ion/util/IonStreamUtils.java#L104
> Do you know who can wipe out this loop?  it's not dead code. I can't understand how dare optimizer
> remove it. 

There are multiple optimizations that could cause a loop to go away. If you still want to find out
and enabling more Print/Trace flags does not help, one way would be to attach a debugger and set a
watchpoint on the loop node inputs to catch when it is removed. It's usually a bit of an effort and
you have to be careful to reset the watchpoint if the nodes input array is reallocated for extension
but it's helpful when everything else fails (you can also try reverse-executing with the rr debugger).

> Another thing is I still have a hard time to understand profile data embedded in IR.
> in this graph:   https://bugs.openjdk.java.net/secure/attachment/84402/JDK-8229450.png
> 677 CountedLoopEnd, [lt] P=0.800000, C=8188.000000
> 520 If,                                P=0.000000, C=4617.000000
> I guess P == possibility and C == counts. my program is same possibilities as replay's. 
Right. Hard to tell why your reproducer does not work but as I said, creating one is a science in
itself and there are multiple approaches (see Roland's suggestions).

Best regards,

More information about the hotspot-compiler-dev mailing list