RFR: 8286197: C2: Optimize MemorySegment shape in int loop

Vladimir Kozlov kvn at openjdk.java.net
Thu May 5 16:50:17 UTC 2022


On Thu, 5 May 2022 16:04:39 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> src/hotspot/share/opto/castnode.cpp line 385:
>> 
>>> 383:     const Type* t = Value(phase);
>>> 384:     const Type* t_in = phase->type(in1);
>>> 385:     if (t != Type::TOP && t_in != Type::TOP && t != t_in) {
>> 
>> `t != t_in` does not mean that type is narrower in general case. I think we need to check ranges (types meet?).
>
> Thanks for looking at this. t is the result of Value() which takes the type of its input into account so, AFAICT, there's no way t can be wider than t_in. Am I missing something? If not I could add an assert. What do you think?

There is no specialized `CastLLNode::Value()` and `ConstraintCastNode` only calls `filter_speculative()` which do call `join()`. May be it is indeed enough. Yes, would be nice to have an assert to make sure we got it right.

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

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


More information about the hotspot-compiler-dev mailing list