[Mlir-commits] [mlir] d923f4c - [mlir][NVVM|ROCDL] Explicitly construct the return type in loadBitcodeFiles in (NVVM|ROCDL)Target
Fabian Mora
llvmlistbot at llvm.org
Sat Aug 12 17:25:38 PDT 2023
Author: Fabian Mora
Date: 2023-08-13T00:25:30Z
New Revision: d923f4c2d824f42817d5a1d8fee9272ce3923f42
URL: https://github.com/llvm/llvm-project/commit/d923f4c2d824f42817d5a1d8fee9272ce3923f42
DIFF: https://github.com/llvm/llvm-project/commit/d923f4c2d824f42817d5a1d8fee9272ce3923f42.diff
LOG: [mlir][NVVM|ROCDL] Explicitly construct the return type in loadBitcodeFiles in (NVVM|ROCDL)Target
Fix a build failure in GCC 7 caused by the function:
`std::optional<SmallVector<std::unique_ptr<llvm::Module>>> loadBitcodeFiles` ,
in `NVVMTarget` & `ROCDLTarget`.
The failure is caused because GCC fails to use the move constructor in
`std::optional` for constructing the return value, which prompts a call to the
deleted copy constructor in `std::unique_ptr`, resulting in a failure.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D157804
Added:
Modified:
mlir/lib/Target/LLVM/NVVM/Target.cpp
mlir/lib/Target/LLVM/ROCDL/Target.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Target/LLVM/NVVM/Target.cpp b/mlir/lib/Target/LLVM/NVVM/Target.cpp
index 5f56eea8ce4925..7c85ae3a12c637 100644
--- a/mlir/lib/Target/LLVM/NVVM/Target.cpp
+++ b/mlir/lib/Target/LLVM/NVVM/Target.cpp
@@ -149,7 +149,7 @@ SerializeGPUModuleBase::loadBitcodeFiles(llvm::Module &module,
if (failed(loadBitcodeFilesFromList(module.getContext(), targetMachine,
fileList, bcFiles, true)))
return std::nullopt;
- return bcFiles;
+ return std::move(bcFiles);
}
#if MLIR_CUDA_CONVERSIONS_ENABLED == 1
diff --git a/mlir/lib/Target/LLVM/ROCDL/Target.cpp b/mlir/lib/Target/LLVM/ROCDL/Target.cpp
index 7636888b48e456..0c08fdc719611f 100644
--- a/mlir/lib/Target/LLVM/ROCDL/Target.cpp
+++ b/mlir/lib/Target/LLVM/ROCDL/Target.cpp
@@ -159,7 +159,7 @@ SerializeGPUModuleBase::loadBitcodeFiles(llvm::Module &module,
if (failed(loadBitcodeFilesFromList(module.getContext(), targetMachine,
fileList, bcFiles, true)))
return std::nullopt;
- return bcFiles;
+ return std::move(bcFiles);
}
LogicalResult
More information about the Mlir-commits
mailing list