RFR: JDK-8308994: C2: Re-implement experimental post loop vectorization

Emanuel Peter epeter at openjdk.org
Fri Jun 23 11:31:05 UTC 2023


On Wed, 21 Jun 2023 08:24:19 GMT, Pengfei Li <pli at openjdk.org> wrote:

> ## TL;DR
> 
> This patch completely re-implements C2's experimental post loop vectorization for better stability, maintainability and performance. Compared with the original implementation, this new implementation adds a standalone loop phase in C2's ideal loop phases and can vectorize more post loops. The original implementation and all code related to multi-versioned post loops are deleted in this patch. More details about this patch can be found in the document replied in this pull request.

src/hotspot/share/opto/vectornode.hpp line 1826:

> 1824: class LoopVectorMaskNode : public TypeNode {
> 1825:  private:
> 1826:   int _max_trips;

Add comment: what is this for exactly? Maybe consider adding more elaborate specification/description above the 3 node classes.

General code style: I think we are trying to get away from the `//--------------NodeName/FunctionName-------` tags, so no need to add them anymore.

src/hotspot/share/opto/vectornode.hpp line 1839:

> 1837:   virtual bool cmp(const Node& n) const {
> 1838:     return TypeNode::cmp(n) &&
> 1839:            _max_trips == ((LoopVectorMaskNode&)n)._max_trips;

Is this cast really safe? Can you use `as_LoopVectorMaskNode()` instead, so we at least have an assert if it fails to be true? I fear this may get us into undefined behavior otherwise...

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14581#discussion_r1239702895
PR Review Comment: https://git.openjdk.org/jdk/pull/14581#discussion_r1239706579


More information about the hotspot-dev mailing list