RFR: 8335628: C2 SuperWord: cleanup: remove SuperWord::longer_type_for_conversion

Emanuel Peter epeter at openjdk.org
Thu Jul 4 06:02:44 UTC 2024


After [JDK-8325155](https://bugs.openjdk.org/browse/JDK-8325155), there is now only a single use of `SuperWord::longer_type_for_conversion`.
The check there is rather useless,  and we should just remove it for the sake of code complexity.

**What did this check do?**
It checks if the input-type of a node is larger than the output type, relevant in these cases:
- `is_convert_opcode`
- `is_scalar_op_that_returns_int_but_vector_op_returns_long`

If there is a larger type, it checks if this larger type can even create vectors of at least size 2:
- `Matcher::max_vector_size_auto_vectorization(longer_bt) < 2)`

Of course if there cannot be vectors for this larger type, then we could avoid creating these vectors.

**Why is it rather useless?**
On most modern platforms, all types have vectors of at least length 2. So this would never fail on those platforms.
And even if this check fails: we would pack the nodes and later reject those packs when we do the `implemented` checks. Hence, we do not wrongly vectorize anyway. The cost of removing this check is that on most platforms we do not have to do this check, and the few that it would fail for just have a bit more compilation time (but very very minimal increase). I think this is worth the reduction in complexity. But we could always revert this change if there are problems because of it.

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

Commit messages:
 - 8335628

Changes: https://git.openjdk.org/jdk/pull/20009/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20009&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8335628
  Stats: 27 lines in 2 files changed: 0 ins; 26 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/20009.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20009/head:pull/20009

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


More information about the hotspot-compiler-dev mailing list