[PATCH] D105382: [GlobalISel] Tail call memcpy/memmove/memset even in the presence of copies

Jon Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 16 14:44:18 PDT 2021


jroelofs added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:508
 
   // Only tail call if the following instruction is a standard return.
   auto Next = next_nodbg(MI.getIterator(), MBB.instr_end());
----------------
aemerson wrote:
> paquette wrote:
> > This comment is out of date with this change.
> Why is it necessary to check for `%0 = COPY $x0`?
> 
> It seems the condition we need to check is that there's a write to $x0 (or whatever register is the return register) of the same vreg value as the first argument to G_MEMCPY.
> 
> ```
> G_MEMCPY %0, %1, %2
> $x0 = COPY %0
> RET_ReallyLR implicit $x0
> ```
> 
On further thought, it isn't necessary. I was thinking that was needed to guarantee that `%0`'s whole live range was assigned to `$x0`, but I don't think we actually need that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105382



More information about the llvm-commits mailing list