JDK-8345306 : C2: Investigate if the matcher unnecessarily clones indirect memory inputs on aarch64
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 24
  • Priority: P4
  • Status: New
  • Resolution: Unresolved
  • CPU: aarch64
  • Submitted: 2024-12-02
  • Updated: 2024-12-02
Related Reports
Relates :  
Description
In JDK-8331295, we discovered that the C2 matcher (instruction selector) unnecessarily clones address computations that are indirect memory input to memory access instructions. The fix for JDK-8331295 covers only a particular case of volatile loads and stores. It may be of interest to do a more rigorous check to see if there are other nodes, that are also cloned indirect memory inputs, that could benefit from a similar treatment.

Comments
There are so many instructions affected (try e.g. grep "indirect mem," src/hotspot/cpu/aarch64/) that some kind of automated solution is required (as opposed to manually adding special cases for each possible Ideal node that can be matched by an instruction with an indirect memory operand). A possible solution would be to let ADLC generate a predicate that takes an Ideal node as input and tells whether the node could be *potentially* matched by a platform instruction with an indirect memory operand, and use this predicate within Matcher::pd_clone_address_expressions().
02-12-2024