RFR: 8270848: Redundant unsafe opmask register allocation in some instruction patterns.

Vladimir Kozlov kvn at openjdk.java.net
Thu Jul 29 01:22:27 UTC 2021


On Fri, 16 Jul 2021 15:51:27 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

> - Some string compare/array equality patters in x86_[32/64].ad files accept the temporary opmark register operands, instructions using these registers are guarded by target feature checks.
> - Even if control path leading to these instructions is not chosen, RA will still allocate physical registers to these temporary operands.
> - Pulling out the feature checks upto the instruction level can save redundant allocations which may effect spilling decisions.
> - Also existing platform dependent routine Matcher::has_predicated_vector() check the existence of AVX512VL feature which is not required.

>From correctness point of view changes are good - we should check features instead of `UseAVX` flag. As we found hard way, not all avx512 CPUs supports all avx512 features.
But it means that this change is only useful on KNL cpus. Or you have other cases?

src/hotspot/cpu/x86/matcher_x86.hpp line 185:

> 183:       return true;
> 184:     }
> 185:     return ret_value;

You can simplify this code by `return UseAVX > 2;`. On other hand, can you use some related feature check as you did in `.ad` files? May be `supports_evex ()`? Is it enough to check that vector masking is supported?

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

PR: https://git.openjdk.java.net/jdk/pull/4813


More information about the hotspot-compiler-dev mailing list