Skip to content

Commit da6626d

Browse files
committed
Revert "[OpenCL] Add support of __opencl_c_pipes feature macro."
This reverts commit d1e4b25.
1 parent d1e4b25 commit da6626d

15 files changed

+35
-66
lines changed

clang/include/clang/Basic/LangOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ LANGOPT(OpenCLVersion , 32, 0, "OpenCL C version")
224224
LANGOPT(OpenCLCPlusPlus , 1, 0, "C++ for OpenCL")
225225
LANGOPT(OpenCLCPlusPlusVersion , 32, 0, "C++ for OpenCL version")
226226
LANGOPT(OpenCLGenericAddressSpace, 1, 0, "OpenCL generic keyword")
227-
LANGOPT(OpenCLPipes , 1, 0, "OpenCL pipes language constructs and built-ins")
227+
LANGOPT(OpenCLPipe , 1, 0, "OpenCL pipe keyword")
228228
LANGOPT(NativeHalfType , 1, 0, "Native half type support")
229229
LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
230230
LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")

clang/lib/Basic/OpenCLOptions.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ bool OpenCLOptions::diagnoseUnsupportedFeatureDependencies(
112112
// supported.
113113
static const llvm::StringMap<llvm::StringRef> DependentFeaturesMap = {
114114
{"__opencl_c_read_write_images", "__opencl_c_images"},
115-
{"__opencl_c_3d_image_writes", "__opencl_c_images"},
116-
{"__opencl_c_pipes", "__opencl_c_generic_address_space"}};
115+
{"__opencl_c_3d_image_writes", "__opencl_c_images"}};
117116

118117
auto OpenCLFeaturesMap = TI.getSupportedOpenCLOpts();
119118

clang/lib/Basic/TargetInfo.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,18 +400,14 @@ void TargetInfo::adjust(DiagnosticsEngine &Diags, LangOptions &Opts) {
400400
// OpenCL C v3.0 s6.7.5 - The generic address space requires support for
401401
// OpenCL C 2.0 or OpenCL C 3.0 with the __opencl_c_generic_address_space
402402
// feature
403-
// OpenCL C v3.0 s6.2.1 - OpenCL pipes require support of OpenCL C 2.0
404-
// or later and __opencl_c_pipes feature
405-
// FIXME: These language options are also defined in setLangDefaults()
403+
// FIXME: OpenCLGenericAddressSpace is also defined in setLangDefaults()
406404
// for OpenCL C 2.0 but with no access to target capabilities. Target
407-
// should be immutable once created and thus these language options need
405+
// should be immutable once created and thus this language option needs
408406
// to be defined only once.
409-
if (Opts.OpenCLVersion == 300) {
407+
if (Opts.OpenCLVersion >= 300) {
410408
const auto &OpenCLFeaturesMap = getSupportedOpenCLOpts();
411409
Opts.OpenCLGenericAddressSpace = hasFeatureEnabled(
412410
OpenCLFeaturesMap, "__opencl_c_generic_address_space");
413-
Opts.OpenCLPipes =
414-
hasFeatureEnabled(OpenCLFeaturesMap, "__opencl_c_pipes");
415411
}
416412
}
417413

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3173,7 +3173,7 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
31733173
Opts.ZVector = 0;
31743174
Opts.setDefaultFPContractMode(LangOptions::FPM_On);
31753175
Opts.OpenCLCPlusPlus = Opts.CPlusPlus;
3176-
Opts.OpenCLPipes = Opts.OpenCLCPlusPlus || Opts.OpenCLVersion == 200;
3176+
Opts.OpenCLPipe = Opts.OpenCLCPlusPlus || Opts.OpenCLVersion == 200;
31773177
Opts.OpenCLGenericAddressSpace =
31783178
Opts.OpenCLCPlusPlus || Opts.OpenCLVersion == 200;
31793179

clang/lib/Parse/ParseDecl.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3952,12 +3952,8 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
39523952
Tok.getIdentifierInfo()->revertTokenIDToIdentifier();
39533953
Tok.setKind(tok::identifier);
39543954
goto DoneWithDeclSpec;
3955-
} else if (!getLangOpts().OpenCLPipes) {
3956-
DiagID = diag::err_opencl_unknown_type_specifier;
3957-
PrevSpec = Tok.getIdentifierInfo()->getNameStart();
3958-
isInvalid = true;
3959-
} else
3960-
isInvalid = DS.SetTypePipe(true, Loc, PrevSpec, DiagID, Policy);
3955+
}
3956+
isInvalid = DS.SetTypePipe(true, Loc, PrevSpec, DiagID, Policy);
39613957
break;
39623958
// We only need to enumerate each image type once.
39633959
#define IMAGE_READ_WRITE_TYPE(Type, Id, Ext)
@@ -5130,10 +5126,8 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) {
51305126
switch (Tok.getKind()) {
51315127
default: return false;
51325128

5133-
// OpenCL 2.0 and later define this keyword.
51345129
case tok::kw_pipe:
5135-
return (getLangOpts().OpenCL && getLangOpts().OpenCLVersion >= 200) ||
5136-
getLangOpts().OpenCLCPlusPlus;
5130+
return getLangOpts().OpenCLPipe;
51375131

51385132
case tok::identifier: // foo::bar
51395133
// Unfortunate hack to support "Class.factoryMethod" notation.
@@ -5662,9 +5656,7 @@ static bool isPtrOperatorToken(tok::TokenKind Kind, const LangOptions &Lang,
56625656
if (Kind == tok::star || Kind == tok::caret)
56635657
return true;
56645658

5665-
// OpenCL 2.0 and later define this keyword.
5666-
if (Kind == tok::kw_pipe &&
5667-
((Lang.OpenCL && Lang.OpenCLVersion >= 200) || Lang.OpenCLCPlusPlus))
5659+
if (Kind == tok::kw_pipe && Lang.OpenCLPipe)
56685660
return true;
56695661

56705662
if (!Lang.CPlusPlus)

clang/lib/Sema/Sema.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,7 @@ void Sema::Initialize() {
333333
if (getLangOpts().OpenCLCPlusPlus || getLangOpts().OpenCLVersion >= 200) {
334334
addImplicitTypedef("clk_event_t", Context.OCLClkEventTy);
335335
addImplicitTypedef("queue_t", Context.OCLQueueTy);
336-
if (getLangOpts().OpenCLPipes)
337-
addImplicitTypedef("reserve_id_t", Context.OCLReserveIDTy);
336+
addImplicitTypedef("reserve_id_t", Context.OCLReserveIDTy);
338337
addImplicitTypedef("atomic_int", Context.getAtomicType(Context.IntTy));
339338
addImplicitTypedef("atomic_uint",
340339
Context.getAtomicType(Context.UnsignedIntTy));

clang/test/CodeGenOpenCL/address-spaces-mangling.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL2.0 -emit-llvm -o - | FileCheck -check-prefix=OCL-20 %s
1010
// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -emit-llvm -o - | FileCheck -check-prefix=OCL-12 %s
1111
// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL3.0 -cl-ext=+__opencl_c_generic_address_space -emit-llvm -o - | FileCheck -check-prefix=OCL-20 %s
12-
// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL3.0 -cl-ext=-__opencl_c_generic_address_space,-__opencl_c_pipes -emit-llvm -o - | FileCheck -check-prefix=OCL-12 %s
12+
// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL3.0 -cl-ext=-__opencl_c_generic_address_space -emit-llvm -o - | FileCheck -check-prefix=OCL-12 %s
1313

1414
// We can't name this f as private is equivalent to default
1515
// no specifier given address space so we get multiple definition

clang/test/CodeGenOpenCL/address-spaces.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang_cc1 %s -O0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,SPIR
2-
// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -cl-ext=-__opencl_c_generic_address_space,-__opencl_c_pipes -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,SPIR
2+
// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -cl-ext=-__opencl_c_generic_address_space -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,SPIR
33
// RUN: %clang_cc1 %s -O0 -DCL20 -cl-std=CL2.0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CL20,CL20SPIR
44
// RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
55
// RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -cl-std=CL3.0 -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s

clang/test/CodeGenOpenCL/pipe_builtin.cl

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,3 @@ void test8(write_only pipe int p, global int *ptr) {
7171
// CHECK: call i32 @__get_pipe_max_packets_wo(%opencl.pipe_wo_t* %{{.*}}, i32 4, i32 4)
7272
*ptr = get_pipe_max_packets(p);
7373
}
74-
75-
struct Person {
76-
const char *Name;
77-
bool isFemale;
78-
int ID;
79-
};
80-
81-
void test9(global struct Person *SDst, read_only pipe struct Person SPipe) {
82-
// CHECK: call i32 @__read_pipe_2(%opencl.pipe_ro_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
83-
read_pipe (SPipe, SDst);
84-
// CHECK: call i32 @__read_pipe_2(%opencl.pipe_ro_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
85-
read_pipe (SPipe, SDst);
86-
}

clang/test/CodeGenOpenCL/pipe_types.cl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
2-
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=CL3.0 -cl-ext=+__opencl_c_pipes,+__opencl_c_generic_address_space -o - %s | FileCheck %s
32

43
// CHECK: %opencl.pipe_ro_t = type opaque
54
// CHECK: %opencl.pipe_wo_t = type opaque
@@ -32,3 +31,18 @@ typedef read_only pipe int MyPipe;
3231
kernel void test6(MyPipe p) {
3332
// CHECK: define{{.*}} spir_kernel void @test6(%opencl.pipe_ro_t* %p)
3433
}
34+
35+
struct Person {
36+
const char *Name;
37+
bool isFemale;
38+
int ID;
39+
};
40+
41+
void test_reserved_read_pipe(global struct Person *SDst,
42+
read_only pipe struct Person SPipe) {
43+
// CHECK: define{{.*}} void @test_reserved_read_pipe
44+
read_pipe (SPipe, SDst);
45+
// CHECK: call i32 @__read_pipe_2(%opencl.pipe_ro_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
46+
read_pipe (SPipe, SDst);
47+
// CHECK: call i32 @__read_pipe_2(%opencl.pipe_ro_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
48+
}

0 commit comments

Comments
 (0)