RFR: 8300257: C2: vectorization fails on some simple Memory Segment loops

Roland Westrelin roland at openjdk.org
Thu Mar 9 16:55:42 UTC 2023


On Thu, 9 Mar 2023 16:28:36 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> So the final expression should be seen by superword as next since `AddP#855` is invariant for inner loop:
> 
> ```
> (AddP#568 base#195 (AddP#949 base#195 (invar#855) (ConvI2L#938 (LShiftI#896 iv#908))))
> ```
> 
> First, I think you messed up with `()`. AddP node should have 3 inputs: base, address and offset. I don't see offset for `AddP#568`. Second, if superword can mark `AddP#855` as invariant (no need to parse it) your address expression become simple.

I left the constant part of the address out of the expressions. So that was on purpose but confusing, sorry.
The current logic only sets the invariant to the result of an integer operation and otherwise follows through the AddP and checks that all of them have the same base. So If we wanted to use the `AddP` as invariant, we would need to change the logic so it stops as the first `AddP` that's loop invariant, we would likely not check that all `AddP` nodes have the same base and we would need to cast the `AddP` to an integer to compute the loop alignment.
Do you think that's better that what I'm proposing? I don't really have a strong opinion. Your suggestion is likely a smaller change.

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

PR: https://git.openjdk.org/jdk/pull/12942


More information about the hotspot-compiler-dev mailing list