This is an archive of the discontinued LLVM Phabricator instance.

[mlir][NVVM|ROCDL] Explicitly construct the return type in loadBitcodeFiles in (NVVM|ROCDL)Target
ClosedPublic

Authored by fmorac on Aug 12 2023, 4:10 PM.

Details

Summary

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.

Diff Detail

Event Timeline

fmorac created this revision.Aug 12 2023, 4:10 PM
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
fmorac edited the summary of this revision. (Show Details)Aug 12 2023, 4:25 PM
fmorac published this revision for review.Aug 12 2023, 4:59 PM
mehdi_amini accepted this revision.Aug 12 2023, 5:11 PM
This revision is now accepted and ready to land.Aug 12 2023, 5:11 PM
mehdi_amini added inline comments.Aug 12 2023, 5:11 PM
mlir/lib/Target/LLVM/ROCDL/Target.cpp
163

return std::move(bcFiles); isn't enough?

fmorac added inline comments.Aug 12 2023, 5:17 PM
mlir/lib/Target/LLVM/ROCDL/Target.cpp
163

It is, I just checked, I didn't want to risk it when I submitted the revision. I'll change it.

fmorac updated this revision to Diff 549669.Aug 12 2023, 5:19 PM

Switched to a single call of std::move

fmorac marked an inline comment as done.Aug 12 2023, 5:19 PM
This revision was landed with ongoing or failed builds.Aug 12 2023, 5:25 PM
This revision was automatically updated to reflect the committed changes.