[PATCH] D78634: AArch64: materialize large stack offset into xzr correctly.

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 06:59:34 PDT 2020


t.p.northover marked 2 inline comments as done.
t.p.northover added a comment.

> Actually, if the destination is XZR, the adds won't have any effect, so surely we don't need to emit any instructions? Could we just early-return without emitting anything if `DestReg == XZR`?

The operation is actually a comparison so the `nzcv` produced is live. And since the code is needed anyway I'd be inclined to let generic DCE handle the non-flag-setting variant.



================
Comment at: llvm/test/CodeGen/AArch64/large-stack-cmp.ll:5
+; CHECK-LABEL: foo:
+; CHECK: adds [[TMP:x[0-9]+]], sp,
+; CHECK: cmn [[TMP]],
----------------
ostannard wrote:
> If two adds are being emitted we should test for both of them, and it would be good to test the immediate values too.
`cmn` is the canonical alias for `adds` when the destination is `xzr`, so we already are.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78634





More information about the llvm-commits mailing list