[aarch64-port-dev ] RFR: aarch64: elide DecodeN when followed by CmpP 0

Andrew Dinn adinn at redhat.com
Mon Sep 21 15:46:45 UTC 2015

Hi Vladimir,

On 16/09/15 17:06, Vladimir Kozlov wrote:
> This is strange. Ideal graph should have CmpN in such case.
> See Compile::final_graph_reshaping_impl() case Op_CmpP:
> Please, look why CmpP is not converted in your case?

You are right that CmpP is not being converted on AArch64. That's
because our ad file implements Matcher::narrow_oop_use_complex_address
as follows:

bool Matcher::narrow_oop_use_complex_address() {
  return Universe::narrow_oop_shift() == 0;

I am not sure why that is how it is defined but I am pretty sure it is
my fault (I think I stole it from ppc.ad when I first created the
AArch64 ad file). Anyway, it's clearly not the right definition.

It looks to me as if the x86_64 version is the right one to use and will
fix the problem Ed is seeing:

bool Matcher::narrow_oop_use_complex_address() {
  assert(UseCompressedOops, "only for compressed oops code");
  return (LogMinObjAlignmentInBytes <= 3);

n.b. I believe the definition of narrow_klass_use_complex_address()
which immediately follows (and is currently defined to return false)
also ought to follow x86:

bool Matcher::narrow_klass_use_complex_address() {
assert(UseCompressedOops, "only for compressed oops code");
return (LogKlassAlignmentInBytes <= 3);

Switching to those definitions certainly seems to fix the issue Ed was
seeing. When I rerun the test without his patch and with these two
alternative definitions the CmpP to CmpN transform is performed and I
see this code generated:

  . . .
  0x000003ffad1c8c94: ldr       w10, [x1,#12]   ; implicit exception:
dispatches to 0x000003ffad1c8cdc
 ;; B2: #       B5 B3 <- B1  Freq: 0.999999

  0x000003ffad1c8c98: cmp       w10, #0x0
  0x000003ffad1c8c9c: b.ls      0x000003ffad1c8cc0  ;*aaload
                                                ; - Decode::main at 2 (line 3)
  . . .


Andrew Dinn
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in UK and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (USA), Matt Parson (USA), Charlie Peters
(USA), Michael O'Neill (Ireland)

More information about the hotspot-compiler-dev mailing list