RFR: 8302673: [SuperWord] MaxReduction and MinReduction should vectorize for int

Emanuel Peter epeter at openjdk.org
Wed May 17 13:27:49 UTC 2023


On Wed, 17 May 2023 13:21:27 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> src/hotspot/share/opto/addnode.cpp line 1103:
>> 
>>> 1101:   }
>>> 1102:   return n;
>>> 1103: }
>> 
>> This was confusing to read.
>> 
>> Why not make it a `as_add_constant`, and explicitly always set the `con`:
>> 
>> case AddI(x, top): return <nullptr, 0>
>> case AddI(x, int_con): return <x, int_con>
>> default: return <n, 0>
>> 
>> That would make it easier to argue what the value of `con` is after the call - it does certainly not depend on what it was before.
>
> Add a comment that explains that for `top` we will bail out - for that we can check `nullptr`.
> In the other cases, we know that `n == AddI(x, int_con)`.

You could also consider having a custom "pair" class, so that the "second-output" is more explicit. But maybe just more useful / explicit variable naming would do the trick. Maybe like `add_var` and `add_con`?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13924#discussion_r1196519924


More information about the hotspot-compiler-dev mailing list