[PATCH] D129997: [Local] Allow creating callbr with duplicate successors

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 18 03:58:33 PDT 2022


nikic added inline comments.


================
Comment at: llvm/test/CodeGen/AArch64/callbr-asm-obj-file.ll:77
 ; CHECK-LABEL: <$x.12>:
-; CHECK-NEXT:    mov w0, wzr
 ; CHECK-NEXT:    ldr x30, [sp], #16
----------------
I believe this change is correct, because we know from a previous condition that `w0` must already be zero at this point. The full assembly is:
```
test3:                                  // @test3
  .cfi_startproc
// %bb.0:
  str x30, [sp, #-16]!                // 8-byte Folded Spill
  .cfi_def_cfa_offset 16
  .cfi_offset w30, -16
  bl  g
  cbz w0, .LBB2_3
// %bb.1:
  bl  i
  cmp w0, #0
  cset  w0, ne
.Ltmp4:                                 // Block address taken
// %bb.2:
  ldr x30, [sp], #16                  // 8-byte Folded Reload
  ret
.LBB2_3:
  //APP
.Ltmp5:
  nop
  .xword  c
  b .Ltmp4
  .xword  0
  //NO_APP
  ldr x30, [sp], #16                  // 8-byte Folded Reload
  ret
.Lfunc_end2:
  .size test3, .Lfunc_end2-test3
  .cfi_endproc
                                        // -- End function
  .hidden l                               // @l
  .type l, at object
  .comm l,4,4
  .section  ".note.GNU-stack","", at progbits
```
This code path is reached through the `cbz w0`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129997/new/

https://reviews.llvm.org/D129997



More information about the llvm-commits mailing list