[PATCH] D20030: [AArch64] Add option to disable speculation of triangle whose tail is the only latch block

Balaram Makam via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 10:27:45 PDT 2016

bmakam added a comment.

Hi Renato,

It seems like this patch is unfavourable to A57. In our internal tests we found that in spec2006/mcf this patch generates the following code difference:

  sub x15, x15, x17                                                             ==  sub x15, x15, x17
  ldr x17, [x14,#16]                                                            ==  ldr x17, [x14,#16]
  ldr x17, [x17]                                                                ==  ldr x17, [x17]
  add x15, x17, x15                                                             ==  add x15, x17, x15
  tbnz x15, #63, L13                                                            ==  tbnz x15, #63, L13
                                                                                >>  cbz x15, L12
  cmp x15, #0x0                                                                 <<
                                                                                >>  cmp w16, #0x2
  ccmp w16, #0x2, #0x0, ne                                                      <<
  b.eq L14                                                                      ==  b.eq L14
  b L12                                                                         ==  b L12

The performance depends on the cost of the cbz here. On Kryo we see 3% gain with this patch whereas on A57 we see 10% regression. This branch seems to be mostly not taken and so when we place the cbz out of the critical path as show below

  tbnz    x15, #63, .LBB2_23
  cmp     w16, #0x2
  b.ne    L12
  cbnz    x15, L14
  b       L12

the performance on A57 improves by 4%. I am not sure but it seems like the cost of cbz on A57 is higher than on Kryo.


More information about the llvm-commits mailing list