[PATCH] D104801: [MemCpyOpt] Enable memcpy optimization for NVPTX back-end.
Artem Belevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 30 15:50:23 PDT 2021
tra added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:1750-1754
- // If we don't have at least memset and memcpy, there is little point of doing
- // anything here. These are required by a freestanding implementation, so if
- // even they are disabled, there is no point in trying hard.
- if (!TLI->has(LibFunc_memset) || !TLI->has(LibFunc_memcpy))
- return false;
----------------
AFAICT the check does not affect correctness.
The "little point of doing anything here" argument is questionable. These optimizations do allow other optimizations to happen and that's exactly how I ended up here -- a memcpy that was not replaced with memset ended up keeping other things alive which resulted in more work for the compiler and slower code at runtime.
In practice only AMDGPU and NVPTX disable these libcalls and for both targets this pass is beneficial. For the others the change is a no-op.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104801/new/
https://reviews.llvm.org/D104801
More information about the llvm-commits
mailing list