Skip to content

Commit c636b33

Browse files
committed
Remove leftovers. Remove unnecessary function. Improve the comment.
1 parent 700fd4a commit c636b33

File tree

3 files changed

+2
-31
lines changed

3 files changed

+2
-31
lines changed

clang/test/Driver/linker-wrapper-image.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@
283283
// SYCL-NEXT: @.offloading.entry_name = internal unnamed_addr constant [5 x i8] c"stub\00", section ".llvm.rodata.offloading", align 1
284284
// SYCL-NEXT: @.offloading.entry.stub = weak constant %struct.__tgt_offload_entry { i64 0, i16 1, i16 8, i32 0, ptr null, ptr @.offloading.entry_name, i64 0, i64 0, ptr null }, section "llvm_offload_entries", align 8
285285
// SYCL-NEXT: @.sycl_offloading.entries_arr = internal constant [1 x %struct.__tgt_offload_entry] [%struct.__tgt_offload_entry { i64 0, i16 1, i16 8, i32 0, ptr null, ptr @.offloading.entry_name, i64 0, i64 0, ptr null }]
286-
// SYCL-NEXT: @.sycl_offloading.0.info = internal local_unnamed_addr constant [2 x i64] [i64 ptrtoint (ptr @.sycl_offloading.0.data to i64), i64 0], section ".tgtimg", align 16
287-
// SYCL-NEXT: @llvm.used = appending global [1 x ptr] [ptr @.sycl_offloading.0.info], section "llvm.metadata"
288286
// SYCL-NEXT: @.sycl_offloading.device_images = internal unnamed_addr constant [1 x %__sycl.tgt_device_image] [%__sycl.tgt_device_image { i16 3, i8 8, i8 0, ptr @.sycl_offloading.target.0, ptr @.sycl_offloading.opts.compile.0, ptr @.sycl_offloading.opts.link.0, ptr @.sycl_offloading.0.data, ptr @.sycl_offloading.0.data, ptr @.sycl_offloading.entries_arr, ptr getelementptr ([1 x %struct.__tgt_offload_entry], ptr @.sycl_offloading.entries_arr, i64 0, i64 1), ptr null, ptr null }]
289287
// SYCL-NEXT: @.sycl_offloading.descriptor = internal constant %__sycl.tgt_bin_desc { i16 1, i16 1, ptr @.sycl_offloading.device_images, ptr null, ptr null }
290288

llvm/include/llvm/Frontend/Offloading/OffloadWrapper.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ struct SYCLJITOptions {
6666

6767
/// Wraps OffloadBinaries in the given \p Buffers into the module \p M
6868
/// as global symbols and registers the images with the SYCL Runtime.
69-
/// \param Options Data that needs to be encoded for the later use in a runtime.
69+
/// \param Options Compiler and linker options to be encoded for the later
70+
/// use by a runtime for JIT compilation.
7071
LLVM_ABI llvm::Error
7172
wrapSYCLBinaries(llvm::Module &M, llvm::ArrayRef<char> Buffer,
7273
SYCLJITOptions Options = SYCLJITOptions());

llvm/lib/Frontend/Offloading/OffloadWrapper.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ using namespace llvm;
3636
using namespace llvm::object;
3737
using namespace llvm::offloading;
3838

39-
using OffloadingImage = OffloadBinary::OffloadingImage;
40-
4139
namespace {
4240
/// Magic number that begins the section containing the CUDA fatbinary.
4341
constexpr unsigned CudaFatMagic = 0x466243b1;
@@ -834,29 +832,6 @@ struct SYCLWrapper {
834832
return std::make_pair(EntriesB, EntriesE);
835833
}
836834

837-
/// Emits a global array that contains \p Address and \P Size. Also add
838-
/// it into llvm.used to force it to be emitted in the object file.
839-
void emitRegistrationFunctions(Constant *Address, size_t Size,
840-
const Twine &ImageID,
841-
StringRef OffloadKindTag) {
842-
Type *IntPtrTy = M.getDataLayout().getIntPtrType(C);
843-
auto *ImgInfoArr =
844-
ConstantArray::get(ArrayType::get(IntPtrTy, 2),
845-
{ConstantExpr::getPointerCast(Address, IntPtrTy),
846-
ConstantInt::get(IntPtrTy, Size)});
847-
auto *ImgInfoVar = new GlobalVariable(
848-
M, ImgInfoArr->getType(), true, GlobalVariable::InternalLinkage,
849-
ImgInfoArr, Twine(OffloadKindTag) + ImageID + ".info");
850-
ImgInfoVar->setAlignment(
851-
MaybeAlign(M.getDataLayout().getTypeStoreSize(IntPtrTy) * 2u));
852-
ImgInfoVar->setUnnamedAddr(GlobalValue::UnnamedAddr::Local);
853-
ImgInfoVar->setSection(".tgtimg");
854-
855-
// Add image info to the used list to force it to be emitted to the
856-
// object.
857-
appendToUsed(M, ImgInfoVar);
858-
}
859-
860835
Constant *wrapImage(const OffloadBinary &OB, const Twine &ImageID,
861836
StringRef OffloadKindTag) {
862837
// Note: Intel DPC++ compiler had 2 versions of this structure
@@ -897,9 +872,6 @@ struct SYCLWrapper {
897872
Binary.second, ImageEntriesPtrs.first, ImageEntriesPtrs.second,
898873
PropertiesConstants.first, PropertiesConstants.second);
899874

900-
emitRegistrationFunctions(Binary.first, RawImage.size(), ImageID,
901-
OffloadKindTag);
902-
903875
return WrappedBinary;
904876
}
905877

0 commit comments

Comments
 (0)