RFR: 8330163: C2: improve CMoveNode::Value() when condition is always true or false [v2]

Roland Westrelin roland at openjdk.org
Wed Apr 17 08:24:10 UTC 2024


On Tue, 16 Apr 2024 17:08:46 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

> For example, given `a & b`, during CCP, if the current value of `a` is `-1`, then `AndINode::Value` would yield `TypeInt::INT` while we can return a more rigorous value of `b`.

Ok. But in that case `AndINode::Value` could be improved, right? Are there cases you can think of where calling `Identity` would result in a type that's narrower than what `Value` could compute.

> I think that if the issue is simply improving `CMoveNode::Value` then you are right, it would be out of the scope. However, given the reasoning for the issue being that it can improve CCP, I think it would be more generalised if we can consult `Identity` during CCP instead, maybe simply changing: `const Type* new_type = n->Value(this);` into `const Type* new_type = n->Identity(this)->Value(this);` would be adequate.

I think it's debatable whether it's the right thing to do and, in any case, it would be quite a bit of extra work. So I intend to go with the small improvement to `CMoveNode::Value`.

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

PR Comment: https://git.openjdk.org/jdk/pull/18757#issuecomment-2060682334


More information about the hotspot-compiler-dev mailing list