Skip to content

Commit d0ca8a7

Browse files
bwlodarczsys-ce-bb
authored andcommitted
Revert "Turn on SPIR-V builtin generation for OpenCL CPP sources (#2466)" (#2508)
This reverts commit 80dfd864ae556369747074bbde8fc1d4c48547be. The commit break Translator in cases when user supplied function is named with the prefix which, after demangling, is the same as OpenCL builtin. The culprit code is placed in during SPIRWriter OCL pass in OCLToSPIRVBase::visitCallInst(CallInst &). Failing name would be for example atomic_fetch_and_sub_uint32_explicit. Original commit: KhronosGroup/SPIRV-LLVM-Translator@9e60105170110e0
1 parent 1a3a71a commit d0ca8a7

File tree

5 files changed

+5
-67
lines changed

5 files changed

+5
-67
lines changed

llvm-spirv/lib/SPIRV/OCLToSPIRV.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,9 @@ bool OCLToSPIRVBase::runOCLToSPIRV(Module &Module) {
168168
auto Src = getSPIRVSource(&Module);
169169
// This is a pre-processing pass, which transform LLVM IR module to a more
170170
// suitable form for the SPIR-V translation: it is specifically designed to
171-
// handle OpenCL C/C++ and C++ for OpenCL modules and shouldn't be launched
172-
// for other source languages.
173-
if (std::get<0>(Src) != spv::SourceLanguageOpenCL_C &&
174-
std::get<0>(Src) != spv::SourceLanguageOpenCL_CPP &&
175-
std::get<0>(Src) != spv::SourceLanguageCPP_for_OpenCL)
171+
// handle OpenCL C built-in functions and shouldn't be launched for other
172+
// source languages
173+
if (std::get<0>(Src) != spv::SourceLanguageOpenCL_C)
176174
return false;
177175

178176
CLVer = std::get<1>(Src);

llvm-spirv/lib/SPIRV/OCLTypeToSPIRV.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,7 @@ bool OCLTypeToSPIRVBase::runOCLTypeToSPIRV(Module &Module) {
8787
AdaptedTy.clear();
8888
WorkSet.clear();
8989
auto Src = getSPIRVSource(&Module);
90-
// This is a pre-processing pass, which transform LLVM IR module to a more
91-
// suitable form for the SPIR-V translation: it is specifically designed to
92-
// handle OpenCL C/C++ and C++ for OpenCL types and shouldn't be launched for
93-
// other source languages.
94-
if (std::get<0>(Src) != spv::SourceLanguageOpenCL_C &&
95-
std::get<0>(Src) != spv::SourceLanguageOpenCL_CPP &&
96-
std::get<0>(Src) != spv::SourceLanguageCPP_for_OpenCL)
90+
if (std::get<0>(Src) != spv::SourceLanguageOpenCL_C)
9791
return false;
9892

9993
for (auto &F : Module.functions())

llvm-spirv/test/extensions/INTEL/SPV_INTEL_arbitrary_precision_fixed_point/capability-arbitrary-precision-fixed-point-numbers.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ attributes #5 = { nounwind }
541541

542542
!0 = !{i32 1, !"wchar_size", i32 4}
543543
!1 = !{i32 1, i32 2}
544-
!2 = !{i32 7, i32 100000}
544+
!2 = !{i32 4, i32 100000}
545545
!3 = !{!"clang version 11.0.0"}
546546
!4 = !{}
547547
!5 = !{!6, !6, i64 0}

llvm-spirv/test/ocl_to_spirv_for_cpp_for_opencl.ll

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

llvm-spirv/test/ocl_to_spirv_for_opencl_cpp.ll

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

0 commit comments

Comments
 (0)