RFR: 8270533: AArch64: size_fits_all_mem_uses should return false if its output is a CAS
Andrew Dinn
adinn at openjdk.java.net
Thu Jul 15 09:49:15 UTC 2021
On Thu, 15 Jul 2021 09:31:49 GMT, Andrew Haley <aph at openjdk.org> wrote:
> `size_fits_all_mem_uses(AddPNode)` is used to determine if an add with shift expression can be used as an input to a MemNode. However, it is not correct when one of its outputs is a CAS. This causes a crash when a single AddPNode feeds a CAS and an ordinary MemNode.
>
> This bug is probably latent in the current HotSpot because `pd_clone_address_expressions()` clones AddPNodes that are used as inputs to MemNodes, so `size_fits_all_mem_uses()` never sees a CAS as one of its outputs. The matcher for a CompareAndSwapX node doesn't call `size_fits_all_mem_uses()`, so this can only happen when the same expression feeds both an ordinary MemNode and a CompareAndSwapX.
>
> This bug has been back-ported to JDK 8u, so it must be fixed there. Even though the bug is latent in current HotSpot, it should be fixed.
Yes, this fix is correct even though it is currently short-circuited by the address cloning code.
-------------
Marked as reviewed by adinn (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/4790
More information about the hotspot-compiler-dev
mailing list