aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/CommandLineTest.cpp
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@fb.com>2022-10-26 19:54:26 -0700
committerPatrick Walton <pcwalton@fb.com>2022-10-30 14:41:03 -0700
commit36bbd68667dbe46626982d3a150891fb85bcc9a8 (patch)
tree06b10973bdff8d80da9d89219652a864d0c719ca /llvm/unittests/Support/CommandLineTest.cpp
parentbf738d2e77846826964402f2cccdd0681c71c038 (diff)
downloadllvm-36bbd68667dbe46626982d3a150891fb85bcc9a8.zip
llvm-36bbd68667dbe46626982d3a150891fb85bcc9a8.tar.gz
llvm-36bbd68667dbe46626982d3a150891fb85bcc9a8.tar.bz2
[InstCombine] Allow memcpys from constant memory to readonly nocapture parameters to be elided.
Currently, InstCombine can elide a memcpy from a constant to a local alloca if that alloca is passed as a nocapture parameter to a *function* that's readnone or readonly, but it can't forward the memcpy if the *argument* is marked readonly nocapture, even though readonly guarantees that the callee won't mutate the pointee through that pointer. This patch adds support for detecting and handling such situations, which arise relatively frequently in Rust, a frontend that liberally emits readonly. A more general version of this optimization would use alias analysis to check the call's ModRef info for the pointee, but I was concerned about blowing up compile time, so for now I'm just checking for one of readnone on the function, readonly on the function, or readonly on the parameter. Differential Revision: https://reviews.llvm.org/D136822
Diffstat (limited to 'llvm/unittests/Support/CommandLineTest.cpp')
0 files changed, 0 insertions, 0 deletions