Skip to content

Commit cedb48f

Browse files
authored
Revert "[SYCL] Generate imported symbol files in sycl-post-link" (#14183)
Reverts #13965 Postcommit broken https://github.com/intel/llvm/actions/runs/9518093318/job/26238170675
1 parent 36be9d0 commit cedb48f

File tree

7 files changed

+6
-165
lines changed

7 files changed

+6
-165
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10702,7 +10702,6 @@ getTripleBasedSYCLPostLinkOpts(const ToolChain &TC, const JobAction &JA,
1070210702
// add options unconditionally
1070310703
addArgs(PostLinkArgs, TCArgs, {"-symbols"});
1070410704
addArgs(PostLinkArgs, TCArgs, {"-emit-exported-symbols"});
10705-
addArgs(PostLinkArgs, TCArgs, {"-emit-imported-symbols"});
1070610705
if (SplitEsimd)
1070710706
addArgs(PostLinkArgs, TCArgs, {"-split-esimd"});
1070810707
addArgs(PostLinkArgs, TCArgs, {"-lower-esimd"});

clang/test/Driver/sycl-device-lib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
// RUN: | FileCheck %s -check-prefix=SYCL_LLVM_LINK_NO_DEVICE_LIB
186186
// SYCL_LLVM_LINK_NO_DEVICE_LIB: clang{{.*}} "-cc1" {{.*}} "-fsycl-is-device"
187187
// SYCL_LLVM_LINK_NO_DEVICE_LIB-NOT: llvm-link{{.*}} "-only-needed"
188-
// SYCL_LLVM_LINK_NO_DEVICE_LIB: sycl-post-link{{.*}} "-symbols" "-emit-exported-symbols" "-emit-imported-symbols"{{.*}} "-o" "{{.*}}.table" "{{.*}}.bc"
188+
// SYCL_LLVM_LINK_NO_DEVICE_LIB: sycl-post-link{{.*}} "-symbols" "-emit-exported-symbols"{{.*}} "-o" "{{.*}}.table" "{{.*}}.bc"
189189

190190
/// ###########################################################################
191191
/// test llvm-link behavior for special user input whose filename resembles SYCL device library

clang/test/Driver/sycl-offload-new-driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
// RUN: %clangxx --target=x86_64-unknown-linux-gnu -fsycl --offload-new-driver \
6161
// RUN: -Xdevice-post-link -post-link-opt -### %s 2>&1 \
6262
// RUN: | FileCheck -check-prefix WRAPPER_OPTIONS_POSTLINK %s
63-
// WRAPPER_OPTIONS_POSTLINK: clang-linker-wrapper{{.*}} "--sycl-post-link-options=-post-link-opt -O2 -device-globals -spec-const=native -split=auto -emit-only-kernels-as-entry-points -symbols -emit-exported-symbols -emit-imported-symbols -lower-esimd"
63+
// WRAPPER_OPTIONS_POSTLINK: clang-linker-wrapper{{.*}} "--sycl-post-link-options=-post-link-opt -O2 -device-globals -spec-const=native -split=auto -emit-only-kernels-as-entry-points -symbols -emit-exported-symbols -lower-esimd"
6464

6565
// -fsycl-device-only behavior
6666
// RUN: %clangxx --target=x86_64-unknown-linux-gnu -fsycl --offload-new-driver \

llvm/include/llvm/Support/PropertySetIO.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ class PropertySetRegistry {
205205
static constexpr char SYCL_MISC_PROP[] = "SYCL/misc properties";
206206
static constexpr char SYCL_ASSERT_USED[] = "SYCL/assert used";
207207
static constexpr char SYCL_EXPORTED_SYMBOLS[] = "SYCL/exported symbols";
208-
static constexpr char SYCL_IMPORTED_SYMBOLS[] = "SYCL/imported symbols";
209208
static constexpr char SYCL_DEVICE_GLOBALS[] = "SYCL/device globals";
210209
static constexpr char SYCL_DEVICE_REQUIREMENTS[] = "SYCL/device requirements";
211210
static constexpr char SYCL_HOST_PIPES[] = "SYCL/host pipes";

llvm/lib/Support/PropertySetIO.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ constexpr char PropertySetRegistry::SYCL_PROGRAM_METADATA[];
202202
constexpr char PropertySetRegistry::SYCL_MISC_PROP[];
203203
constexpr char PropertySetRegistry::SYCL_ASSERT_USED[];
204204
constexpr char PropertySetRegistry::SYCL_EXPORTED_SYMBOLS[];
205-
constexpr char PropertySetRegistry::SYCL_IMPORTED_SYMBOLS[];
206205
constexpr char PropertySetRegistry::SYCL_DEVICE_GLOBALS[];
207206
constexpr char PropertySetRegistry::SYCL_DEVICE_REQUIREMENTS[];
208207
constexpr char PropertySetRegistry::SYCL_HOST_PIPES[];

llvm/test/tools/sycl-post-link/emit_imported_symbols.ll

Lines changed: 0 additions & 113 deletions
This file was deleted.

llvm/tools/sycl-post-link/sycl-post-link.cpp

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "llvm/Analysis/TargetLibraryInfo.h"
2626
#include "llvm/Analysis/TargetTransformInfo.h"
2727
#include "llvm/Bitcode/BitcodeWriterPass.h"
28-
#include "llvm/Demangle/Demangle.h"
2928
#include "llvm/GenXIntrinsics/GenXSPIRVWriterAdaptor.h"
3029
#include "llvm/IR/Dominators.h"
3130
#include "llvm/IR/LLVMContext.h"
@@ -229,10 +228,6 @@ cl::opt<bool> EmitExportedSymbols{"emit-exported-symbols",
229228
cl::desc("emit exported symbols"),
230229
cl::cat(PostLinkCat)};
231230

232-
cl::opt<bool> EmitImportedSymbols{"emit-imported-symbols",
233-
cl::desc("emit imported symbols"),
234-
cl::cat(PostLinkCat)};
235-
236231
cl::opt<bool> EmitOnlyKernelsAsEntryPoints{
237232
"emit-only-kernels-as-entry-points",
238233
cl::desc("Consider only sycl_kernel functions as entry points for "
@@ -255,7 +250,6 @@ struct GlobalBinImageProps {
255250
bool EmitKernelParamInfo;
256251
bool EmitProgramMetadata;
257252
bool EmitExportedSymbols;
258-
bool EmitImportedSymbols;
259253
bool EmitDeviceGlobalPropSet;
260254
};
261255

@@ -417,25 +411,6 @@ std::string saveModuleIR(Module &M, int I, StringRef Suff) {
417411
return OutFilename;
418412
}
419413

420-
bool isImportedFunction(const Function &F) {
421-
if (!F.isDeclaration() || F.isIntrinsic() ||
422-
!llvm::sycl::utils::isSYCLExternalFunction(&F))
423-
return false;
424-
425-
// StripDeadPrototypes is called during module splitting
426-
// cleanup. At this point all function decls should have uses.
427-
assert(!F.use_empty() && "Function F has no uses");
428-
429-
bool ReturnValue = true;
430-
if (char *NameStr = itaniumDemangle(F.getName())) {
431-
StringRef DemangledName(NameStr);
432-
if (DemangledName.starts_with("__"))
433-
ReturnValue = false;
434-
free(NameStr);
435-
}
436-
return ReturnValue;
437-
}
438-
439414
std::string saveModuleProperties(module_split::ModuleDesc &MD,
440415
const GlobalBinImageProps &GlobProps, int I,
441416
StringRef Suff) {
@@ -499,21 +474,10 @@ std::string saveModuleProperties(module_split::ModuleDesc &MD,
499474
// so they won't make it into the export list. Should the check be
500475
// F->getCallingConv() != CallingConv::SPIR_KERNEL?
501476
if (F->getCallingConv() == CallingConv::SPIR_FUNC) {
502-
PropSet.add(PropSetRegTy::SYCL_EXPORTED_SYMBOLS, F->getName(),
503-
/*PropVal=*/true);
477+
PropSet.add(PropSetRegTy::SYCL_EXPORTED_SYMBOLS, F->getName(), true);
504478
}
505479
}
506480
}
507-
508-
if (GlobProps.EmitImportedSymbols) {
509-
// record imported functions in the property set
510-
for (const auto &F : M) {
511-
if (isImportedFunction(F))
512-
PropSet.add(PropSetRegTy::SYCL_IMPORTED_SYMBOLS, F.getName(),
513-
/*PropVal=*/true);
514-
}
515-
}
516-
517481
// Metadata names may be composite so we keep them alive until the
518482
// properties have been written.
519483
SmallVector<std::string, 4> MetadataNames;
@@ -766,8 +730,7 @@ IrPropSymFilenameTriple saveModule(module_split::ModuleDesc &MD, int I,
766730
Res.Ir = saveModuleIR(MD.getModule(), I, Suffix);
767731
}
768732
GlobalBinImageProps Props = {EmitKernelParamInfo, EmitProgramMetadata,
769-
EmitExportedSymbols, EmitImportedSymbols,
770-
DeviceGlobals};
733+
EmitExportedSymbols, DeviceGlobals};
771734
Res.Prop = saveModuleProperties(MD, Props, I, Suffix);
772735

773736
if (DoSymGen) {
@@ -1286,14 +1249,13 @@ int main(int argc, char **argv) {
12861249
bool DoParamInfo = EmitKernelParamInfo.getNumOccurrences() > 0;
12871250
bool DoProgMetadata = EmitProgramMetadata.getNumOccurrences() > 0;
12881251
bool DoExportedSyms = EmitExportedSymbols.getNumOccurrences() > 0;
1289-
bool DoImportedSyms = EmitImportedSymbols.getNumOccurrences() > 0;
12901252
bool DoDeviceGlobals = DeviceGlobals.getNumOccurrences() > 0;
12911253
bool DoGenerateDeviceImageWithDefaulValues =
12921254
GenerateDeviceImageWithDefaultSpecConsts.getNumOccurrences() > 0;
12931255

12941256
if (!DoSplit && !DoSpecConst && !DoSymGen && !DoParamInfo &&
1295-
!DoProgMetadata && !DoSplitEsimd && !DoExportedSyms && !DoImportedSyms &&
1296-
!DoDeviceGlobals && !DoLowerEsimd) {
1257+
!DoProgMetadata && !DoSplitEsimd && !DoExportedSyms && !DoDeviceGlobals &&
1258+
!DoLowerEsimd) {
12971259
errs() << "no actions specified; try --help for usage info\n";
12981260
return 1;
12991261
}
@@ -1327,11 +1289,6 @@ int main(int argc, char **argv) {
13271289
<< " -" << IROutputOnly.ArgStr << "\n";
13281290
return 1;
13291291
}
1330-
if (IROutputOnly && DoImportedSyms) {
1331-
errs() << "error: -" << EmitImportedSymbols.ArgStr << " can't be used with"
1332-
<< " -" << IROutputOnly.ArgStr << "\n";
1333-
return 1;
1334-
}
13351292
if (IROutputOnly && DoGenerateDeviceImageWithDefaulValues) {
13361293
errs() << "error: -" << GenerateDeviceImageWithDefaultSpecConsts.ArgStr
13371294
<< " can't be used with -" << IROutputOnly.ArgStr << "\n";

0 commit comments

Comments
 (0)