[MemCpyOpt] Relax libcall checks
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 25 Jul 2021 15:34:17 +0000 (17:34 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 4 Aug 2021 19:17:51 +0000 (21:17 +0200)
commitbb15861e149ac1ce01ed5bd87f760e9469b20a9d
tree6e48d89b224e11460e62cb8e312e265616e19166
parentfb27e8c76e04e093dcd378b8a76341a7b6ed3b0c
[MemCpyOpt] Relax libcall checks

Rather than blocking the whole MemCpyOpt pass if the libcalls are
not available, only disable creation of new memset/memcpy intrinsics
where only load/stores were used previously. This only affects the
store merging and load-store conversion optimization. Other
optimizations are derived from existing intrinsics, which are
well-defined in the absence of libcalls -- not having the libcalls
just means that call simplification won't convert them to intrinsics.

This is a weaker variation of D104801, which dropped these checks
entirely. Ideally we would not couple emission of intrinsics to
libcall availability at all, but as the intrinsics may be legalized
to libcalls we need to be a bit careful right now.

Differential Revision: https://reviews.llvm.org/D106769
llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
llvm/test/Transforms/MemCpyOpt/no-libcalls.ll [new file with mode: 0644]