[PATCH] D101657: [PowerPC] Handle inline assembly clobber of link regsiter

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 30 13:25:38 PST 2021


nickdesaulniers added a subscriber: jyknight.
nickdesaulniers added inline comments.


================
Comment at: llvm/test/CodeGen/PowerPC/ppc64-inlineasm-clobber.ll:76-94
+; PPC64LE-LABEL: ClobberLR_BR:
+; PPC64LE:       # %bb.0: # %entry
+; PPC64LE-NEXT:    #APP
+; PPC64LE-NEXT:    nop
+; PPC64LE-NEXT:    #NO_APP
+; PPC64LE-NEXT:  # %bb.1: # %return
+; PPC64LE-NEXT:    extsw r3, r3
----------------
@jyknight points out in review of D115688 that something looks fishy with this `callbr` unit test, and I think he's right (and I'm sorry I didn't catch this earlier in code review).

Let's say the asm string actually writes to `lr` rather than being simply a `nop` in this example, hence why it's in the clobber list.  In that case, branching to the lr (returning) will not branch to the restored value of `lr`, but the one updated from the inline asm.  I don't think that's correct.

Should the `mflr`/`mtlr` "surround" the user supplied asm? Otherwise this looks like a pointless spill+reload on the indirect branch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101657



More information about the llvm-commits mailing list