llvm-project/llvm/lib/Transforms/Instrumentation
David Blaikie 0c4dbf9ecd Assigning to a local object in a return statement prevents copy elision. NFC.
I added a diagnostic along the lines of `-Wpessimizing-move` to detect `return x = y` suppressing copy elision, but I don't know if the diagnostic is really worth it. Anyway, here are the places where my diagnostic reported that copy elision would have been possible if not for the assignment.

P1155R1 in the post-San-Diego WG21 (C++ committee) mailing discusses whether WG21 should fix this pitfall by just changing the core language to permit copy elision in cases like these.

(Kona update: The bulk of P1155 is proceeding to CWG review, but specifically *not* the parts that explored the notion of permitting copy-elision in these specific cases.)

Reviewed By: dblaikie

Author: Arthur O'Dwyer

Differential Revision: https://reviews.llvm.org/D54885

llvm-svn: 359236
2019-04-25 20:09:00 +00:00
..
AddressSanitizer.cpp [CommandLine] Provide parser<unsigned long> instantiation to allow cl::opt<uint64_t> on LP64 platforms 2019-04-24 02:40:20 +00:00
BoundsChecking.cpp Add a 'dynamic' parameter to the objectsize intrinsic 2019-01-30 20:34:35 +00:00
CFGMST.h Use llvm::stable_sort 2019-04-23 14:51:27 +00:00
CGProfile.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CMakeLists.txt Remove esan. 2019-03-11 20:23:40 +00:00
ControlHeightReduction.cpp Use llvm::stable_sort 2019-04-23 14:51:27 +00:00
DataFlowSanitizer.cpp Add "const" in GetUnderlyingObjects. NFC 2019-04-24 06:55:50 +00:00
GCOVProfiling.cpp [opaque pointer types] Pass value type to GetElementPtr creation. 2019-02-01 20:44:47 +00:00
HWAddressSanitizer.cpp [CommandLine] Provide parser<unsigned long> instantiation to allow cl::opt<uint64_t> on LP64 platforms 2019-04-24 02:40:20 +00:00
IndirectCallPromotion.cpp Change some dyn_cast to more apropriate isa. NFC 2019-04-05 16:16:23 +00:00
InstrOrderFile.cpp Try to fix NetBSD buildbot breakage introduced in D57463. 2019-03-01 15:25:24 +00:00
InstrProfiling.cpp [InstrProf] Use separate comdat group for data and counters 2019-02-27 23:38:44 +00:00
Instrumentation.cpp Assigning to a local object in a return statement prevents copy elision. NFC. 2019-04-25 20:09:00 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MaximumSpanningTree.h Use llvm::stable_sort 2019-04-23 14:51:27 +00:00
MemorySanitizer.cpp [CommandLine] Provide parser<unsigned long> instantiation to allow cl::opt<uint64_t> on LP64 platforms 2019-04-24 02:40:20 +00:00
PGOInstrumentation.cpp The error message for mismatched value sites is very cryptic. 2019-04-23 22:26:55 +00:00
PGOMemOPSizeOpt.cpp Move DomTreeUpdater from IR to Analysis 2019-02-06 02:52:52 +00:00
SanitizerCoverage.cpp [SanitizerCoverage] Avoid splitting critical edges when destination is a basic block containing unreachable 2019-03-12 18:20:25 +00:00
ThreadSanitizer.cpp [opaque pointer types] Add a FunctionCallee wrapper type, and use it. 2019-02-01 02:28:03 +00:00