-
Type:
Enhancement
-
Resolution: Duplicate
-
Priority:
P4
-
Affects Version/s: 23
-
Component/s: hotspot
-
generic
-
generic
For example:
```
for (long i = 0; i < n; ++i) { foo(a + i + b); }
```
Can be reassociated to get
```
for (long i = 0; i < n; ++i) { foo(a + b + i); }
```
There is already reassociation code, but it is only applied to `CountedLoop`. `LongCountedLoop` is not a `CountedLoop` by inheritance. https://github.com/openjdk/jdk/blob/99c9ae127c0a3b8c4fc6ede87079ff7c693a2905/src/hotspot/share/opto/loopnode.cpp#L4772-L4777
This might have been regressed inJDK-8259609
The code is there already
```
for (long i = 0; i < n; ++i) { foo(a + i + b); }
```
Can be reassociated to get
```
for (long i = 0; i < n; ++i) { foo(a + b + i); }
```
There is already reassociation code, but it is only applied to `CountedLoop`. `LongCountedLoop` is not a `CountedLoop` by inheritance. https://github.com/openjdk/jdk/blob/99c9ae127c0a3b8c4fc6ede87079ff7c693a2905/src/hotspot/share/opto/loopnode.cpp#L4772-L4777
This might have been regressed in
The code is there already
- duplicates
-
JDK-8369258 C2: enable ReassociateInvariants for all loop types
-
- Resolved
-