[PATCH] D100870: [MemCpyOpt] Allow variable lengths in memcpy optimizer

Olle Fredriksson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 10:42:08 PDT 2021


ollef created this revision.
ollef added a reviewer: nikic.
Herald added a subscriber: hiraditya.
ollef requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This makes the memcpy-memcpy and memcpy-memset optimizations work for
variable sizes as long as they are equal, relaxing the old restriction
that they are constant integers. If they're not equal, the old
requirement that they are constant integers with certain size
restrictions is used.

The implementation works by pushing the length tests further down in the
code, which reveals some places where it's enough that the lengths are
equal (but not necessarily constant).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100870

Files:
  llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
  llvm/test/Transforms/MemCpyOpt/variable-sized-memcpy-memcpy.ll
  llvm/test/Transforms/MemCpyOpt/variable-sized-memset-memcpy.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100870.338919.patch
Type: text/x-patch
Size: 14946 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210420/ec9cbda7/attachment.bin>


More information about the llvm-commits mailing list