Skip to content

Commit 4c83753

Browse files
[SYCL][NFC] Drop confusing std::moves (#20483)
This is similar to #20455 - there is a bunch of places where we call `std::move(const obj &)`, but target classes do not provide `obj(const &&)` move constructors, falling back to regular `obj(const &)` copy constructor, thus making the `std::move` useless and confusing. This should also help clean up the Coverity scan (https://scan.coverity.com/projects/intel-llvm?tab=overview), see CIDs `535398`, `535480`, `535420` and `535554`. By some reason Coverity thinks that we are using a moved object, whilst in fact no moves were performed, only copies.
1 parent 52fe935 commit 4c83753

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

sycl/source/detail/device_image_impl.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ class device_image_impl
296296
KernelNameSetT &&KernelNames,
297297
KernelNameToArgMaskMap &&EliminatedKernelArgMasks,
298298
std::unique_ptr<DynRTDeviceBinaryImage> &&MergedImageStorage, private_tag)
299-
: MBinImage(BinImage), MContext(std::move(Context)),
299+
: MBinImage(BinImage), MContext(Context),
300300
MDevices(Devices.to<std::vector<device_impl *>>()), MState(State),
301301
MProgram(std::move(Program)), MKernelIDs(std::move(KernelIDs)),
302302
MKernelNames{std::move(KernelNames)},
@@ -315,7 +315,7 @@ class device_image_impl
315315
MangledKernelNameMapT &&MangledKernelNames, std::string &&Prefix,
316316
std::shared_ptr<ManagedDeviceGlobalsRegistry> &&DeviceGlobalRegistry,
317317
private_tag)
318-
: MBinImage(BinImage), MContext(std::move(Context)),
318+
: MBinImage(BinImage), MContext(Context),
319319
MDevices(Devices.to<std::vector<device_impl *>>()), MState(State),
320320
MKernelIDs(std::move(KernelIDs)), MKernelNames{std::move(KernelNames)},
321321
MSpecConstsDefValBlob(getSpecConstsDefValBlob()),
@@ -329,7 +329,7 @@ class device_image_impl
329329
device_image_impl(const std::string &Src, context Context,
330330
devices_range Devices, syclex::source_language Lang,
331331
include_pairs_t &&IncludePairsVec, private_tag)
332-
: MBinImage(Src), MContext(std::move(Context)),
332+
: MBinImage(Src), MContext(Context),
333333
MDevices(Devices.to<std::vector<device_impl *>>()),
334334
MState(bundle_state::ext_oneapi_source),
335335
MSpecConstsDefValBlob(getSpecConstsDefValBlob()),
@@ -342,7 +342,7 @@ class device_image_impl
342342
device_image_impl(const std::vector<std::byte> &Bytes, const context &Context,
343343
devices_range Devices, syclex::source_language Lang,
344344
private_tag)
345-
: MBinImage(Bytes), MContext(std::move(Context)),
345+
: MBinImage(Bytes), MContext(Context),
346346
MDevices(Devices.to<std::vector<device_impl *>>()),
347347
MState(bundle_state::ext_oneapi_source),
348348
MSpecConstsDefValBlob(getSpecConstsDefValBlob()),
@@ -356,9 +356,9 @@ class device_image_impl
356356
syclex::source_language Lang, KernelNameSetT &&KernelNames,
357357
private_tag)
358358
: MBinImage(static_cast<const RTDeviceBinaryImage *>(nullptr)),
359-
MContext(std::move(Context)),
360-
MDevices(Devices.to<std::vector<device_impl *>>()), MState(State),
361-
MProgram(std::move(Program)), MKernelNames{std::move(KernelNames)},
359+
MContext(Context), MDevices(Devices.to<std::vector<device_impl *>>()),
360+
MState(State), MProgram(std::move(Program)),
361+
MKernelNames{std::move(KernelNames)},
362362
MSpecConstsDefValBlob(getSpecConstsDefValBlob()),
363363
MOrigins(ImageOriginKernelCompiler),
364364
MRTCBinInfo(KernelCompilerBinaryInfo{Lang}) {}

sycl/source/detail/scheduler/commands.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,8 +1511,8 @@ MemCpyCommand::MemCpyCommand(const Requirement &SrcReq,
15111511
queue_impl *SrcQueue, queue_impl *DstQueue)
15121512
: Command(CommandType::COPY_MEMORY, DstQueue),
15131513
MSrcQueue(SrcQueue ? SrcQueue->shared_from_this() : nullptr),
1514-
MSrcReq(std::move(SrcReq)), MSrcAllocaCmd(SrcAllocaCmd),
1515-
MDstReq(std::move(DstReq)), MDstAllocaCmd(DstAllocaCmd) {
1514+
MSrcReq(SrcReq), MSrcAllocaCmd(SrcAllocaCmd), MDstReq(DstReq),
1515+
MDstAllocaCmd(DstAllocaCmd) {
15161516
if (MSrcQueue) {
15171517
MEvent->setContextImpl(MSrcQueue->getContextImpl());
15181518
}

0 commit comments

Comments
 (0)