]> granicus.if.org Git - clang/commitdiff
Revert "[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand."
authorDaniel Jasper <djasper@google.com>
Tue, 20 Dec 2016 10:05:04 +0000 (10:05 +0000)
committerDaniel Jasper <djasper@google.com>
Tue, 20 Dec 2016 10:05:04 +0000 (10:05 +0000)
This reverts commit r290171. It triggers a bunch of warnings, because
the new enumerator isn't handled in all switches. We want a warning-free
build.

Replied on the commit with more details.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290173 91177308-0d34-0410-b5e6-96231b3b80d8

14 files changed:
include/clang/AST/OperationKinds.def
include/clang/Sema/Initialization.h
include/clang/Sema/Overload.h
lib/AST/ExprConstant.cpp
lib/CodeGen/CGExprAgg.cpp
lib/CodeGen/CGExprComplex.cpp
lib/CodeGen/CGExprScalar.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaInit.cpp
lib/Sema/SemaOverload.cpp
test/CodeGenOpenCL/null_queue.cl [deleted file]
test/SemaOpenCL/null_queue.cl [deleted file]
test/SemaOpenCL/queue_t_overload.cl [deleted file]

index 2d48a7df47b7a8d934258dd50ddc42aee6b60973..03a61e94e297290650b1f4541819c915a4611f04 100644 (file)
@@ -321,9 +321,6 @@ CAST_OPERATION(BuiltinFnToFnPtr)
 // Convert a zero value for OpenCL event_t initialization.
 CAST_OPERATION(ZeroToOCLEvent)
 
-// Convert a zero value for OpenCL queue_t initialization.
-CAST_OPERATION(ZeroToOCLQueue)
-
 // Convert a pointer to a different address space.
 CAST_OPERATION(AddressSpaceConversion)
 
index a7b8cce32691c3093cad0ce228b6e8abb43e41ab..c2795fcaf3a455da91a29b078732b39fbfb88f71 100644 (file)
@@ -751,8 +751,6 @@ public:
     SK_StdInitializerListConstructorCall,
     /// \brief Initialize an OpenCL sampler from an integer.
     SK_OCLSamplerInit,
-    /// \brief Initialize queue_t from 0.
-    SK_OCLZeroQueue,
     /// \brief Passing zero to a function where OpenCL event_t is expected.
     SK_OCLZeroEvent
   };
@@ -1150,9 +1148,6 @@ public:
   /// constant.
   void AddOCLZeroEventStep(QualType T);
 
-  /// \brief Add a step to initialize an OpenCL queue_t from 0.
-  void AddOCLZeroQueueStep(QualType T);
-
   /// \brief Add steps to unwrap a initializer list for a reference around a
   /// single element and rewrap it at the end.
   void RewrapReferenceInitList(QualType T, InitListExpr *Syntactic);
index 9771044a075ce54d1a87a76c0a8fc290d0c41c59..7c6699aca01dfd549ae2557a91d774d213649d8c 100644 (file)
@@ -83,7 +83,6 @@ namespace clang {
     ICK_TransparentUnionConversion, ///< Transparent Union Conversions
     ICK_Writeback_Conversion,  ///< Objective-C ARC writeback conversion
     ICK_Zero_Event_Conversion, ///< Zero constant to event (OpenCL1.2 6.12.10)
-    ICK_Zero_Queue_Conversion, ///< Zero constant to queue
     ICK_C_Only_Conversion,     ///< Conversions allowed in C, but not C++
     ICK_Incompatible_Pointer_Conversion, ///< C-only conversion between pointers
                                          ///  with incompatible types
index c7310a8feb5d11554d93f9e0ba20e63a589fad56..0abdaa879ec25398bd1200a43a87fc52907428e3 100644 (file)
@@ -8340,7 +8340,6 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
   case CK_IntegralComplexToFloatingComplex:
   case CK_BuiltinFnToFnPtr:
   case CK_ZeroToOCLEvent:
-  case CK_ZeroToOCLQueue:
   case CK_NonAtomicToAtomic:
   case CK_AddressSpaceConversion:
   case CK_IntToOCLSampler:
@@ -8838,7 +8837,6 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
   case CK_CopyAndAutoreleaseBlockObject:
   case CK_BuiltinFnToFnPtr:
   case CK_ZeroToOCLEvent:
-  case CK_ZeroToOCLQueue:
   case CK_NonAtomicToAtomic:
   case CK_AddressSpaceConversion:
   case CK_IntToOCLSampler:
index 009244784e5046c5f9d44724bbbc6e3085456af3..35148bea0019a4d63ea05f7339c6f583d8275c6f 100644 (file)
@@ -751,7 +751,6 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) {
   case CK_CopyAndAutoreleaseBlockObject:
   case CK_BuiltinFnToFnPtr:
   case CK_ZeroToOCLEvent:
-  case CK_ZeroToOCLQueue:
   case CK_AddressSpaceConversion:
   case CK_IntToOCLSampler:
     llvm_unreachable("cast kind invalid for aggregate types");
index 59bc9cdbc0567303cd07d60bd12e9862b1a75466..60bbc5cfac1e16dc2e7d4513961caac7ccd8d664 100644 (file)
@@ -480,7 +480,6 @@ ComplexPairTy ComplexExprEmitter::EmitCast(CastKind CK, Expr *Op,
   case CK_CopyAndAutoreleaseBlockObject:
   case CK_BuiltinFnToFnPtr:
   case CK_ZeroToOCLEvent:
-  case CK_ZeroToOCLQueue:
   case CK_AddressSpaceConversion:
   case CK_IntToOCLSampler:
     llvm_unreachable("invalid cast kind for complex value");
index 1b85c45cd4be16682e7c96999ef26165e767c2a2..e9bdbda34aa62bf153063c03cc72a5bd210ab618 100644 (file)
@@ -1593,11 +1593,6 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
     return llvm::Constant::getNullValue(ConvertType(DestTy));
   }
 
-  case CK_ZeroToOCLQueue: {
-    assert(DestTy->isQueueT() && "CK_ZeroToOCLQueue cast on non queue_t type");
-    return llvm::Constant::getNullValue(ConvertType(DestTy));
-  }
-
   case CK_IntToOCLSampler:
     return CGF.CGM.createOpenCLIntToSamplerConversion(E, CGF);\r
 
index 3c554c9a5244f1753f5c7ffc1a1e520cd3b3faea..b888345691130dc95b91e746244d79d349c2884b 100644 (file)
@@ -9635,18 +9635,6 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
     return ResultTy;
   }
 
-  if (getLangOpts().OpenCLVersion >= 200) {
-    if (LHSIsNull && RHSType->isQueueT()) {
-      LHS = ImpCastExprToType(LHS.get(), RHSType, CK_NullToPointer);
-      return ResultTy;
-    }
-
-    if (LHSType->isQueueT() && RHSIsNull) {
-      RHS = ImpCastExprToType(RHS.get(), LHSType, CK_NullToPointer);
-      return ResultTy;
-    }
-  }
-
   return InvalidOperands(Loc, LHS, RHS);
 }
 
index 6967a4babd6fed72507057801daa8eb0c398d6bf..74beeac724413c12b73e4dca5087901905dcfba8 100644 (file)
@@ -3878,12 +3878,6 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
                              From->getValueKind()).get();
     break;
 
-  case ICK_Zero_Queue_Conversion:
-    From = ImpCastExprToType(From, ToType,
-                             CK_ZeroToOCLQueue,
-                             From->getValueKind()).get();
-    break;
-
   case ICK_Lvalue_To_Rvalue:
   case ICK_Array_To_Pointer:
   case ICK_Function_To_Pointer:
index 895ccb54844b84196422dc798c3cc2f1d97782e7..ce012896f5bf7f488a1d0a2d02f98873f76b540a 100644 (file)
@@ -3077,7 +3077,6 @@ void InitializationSequence::Step::Destroy() {
   case SK_StdInitializerListConstructorCall:
   case SK_OCLSamplerInit:
   case SK_OCLZeroEvent:
-  case SK_OCLZeroQueue:
     break;
 
   case SK_ConversionSequence:
@@ -3366,13 +3365,6 @@ void InitializationSequence::AddOCLZeroEventStep(QualType T) {
   Steps.push_back(S);
 }
 
-void InitializationSequence::AddOCLZeroQueueStep(QualType T) {
-  Step S;
-  S.Kind = SK_OCLZeroQueue;
-  S.Type = T;
-  Steps.push_back(S);
-}
-
 void InitializationSequence::RewrapReferenceInitList(QualType T,
                                                      InitListExpr *Syntactic) {
   assert(Syntactic->getNumInits() == 1 &&
@@ -5038,20 +5030,6 @@ static bool TryOCLZeroEventInitialization(Sema &S,
   return true;
 }
 
-static bool TryOCLZeroQueueInitialization(Sema &S,
-                                          InitializationSequence &Sequence,
-                                          QualType DestType,
-                                          Expr *Initializer) {
-  if (!S.getLangOpts().OpenCL || S.getLangOpts().OpenCLVersion < 200 ||
-      !DestType->isQueueT() ||
-      !Initializer->isIntegerConstantExpr(S.getASTContext()) ||
-      (Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0))
-    return false;
-
-  Sequence.AddOCLZeroQueueStep(DestType);
-  return true;
-}
-
 InitializationSequence::InitializationSequence(Sema &S,
                                                const InitializedEntity &Entity,
                                                const InitializationKind &Kind,
@@ -5314,9 +5292,6 @@ void InitializationSequence::InitializeFrom(Sema &S,
     if (TryOCLZeroEventInitialization(S, *this, DestType, Initializer))
       return;
 
-    if (TryOCLZeroQueueInitialization(S, *this, DestType, Initializer))
-       return;
-
     // Handle initialization in C
     AddCAssignmentStep(DestType);
     MaybeProduceObjCObject(S, *this, Entity);
@@ -6554,8 +6529,7 @@ InitializationSequence::Perform(Sema &S,
   case SK_ProduceObjCObject:
   case SK_StdInitializerList:
   case SK_OCLSamplerInit:
-  case SK_OCLZeroEvent:
-  case SK_OCLZeroQueue: {
+  case SK_OCLZeroEvent: {
     assert(Args.size() == 1);
     CurInit = Args[0];
     if (!CurInit.get()) return ExprError();
@@ -7239,15 +7213,6 @@ InitializationSequence::Perform(Sema &S,
                                     CurInit.get()->getValueKind());
       break;
     }
-    case SK_OCLZeroQueue: {
-      assert(Step->Type->isQueueT() &&
-             "Event initialization on non queue type.");
-
-      CurInit = S.ImpCastExprToType(CurInit.get(), Step->Type,
-                                    CK_ZeroToOCLQueue,
-                                    CurInit.get()->getValueKind());
-      break;
-    }
     }
   }
 
@@ -8076,10 +8041,6 @@ void InitializationSequence::dump(raw_ostream &OS) const {
     case SK_OCLZeroEvent:
       OS << "OpenCL event_t from zero";
       break;
-
-    case SK_OCLZeroQueue:
-      OS << "OpenCL queue_t from zero";
-      break;
     }
 
     OS << " [" << S->Type.getAsString() << ']';
index c8a45013e9e13254bdc8840395824f45abd65e75..d49142b8d8532638cc8bab19bf55acd88331ea35 100644 (file)
@@ -1785,11 +1785,6 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
              From->EvaluateKnownConstInt(S.getASTContext()) == 0) {
     SCS.Second = ICK_Zero_Event_Conversion;
     FromType = ToType;
-  } else if (ToType->isQueueT() &&
-             From->isIntegerConstantExpr(S.getASTContext()) &&
-             (From->EvaluateKnownConstInt(S.getASTContext()) == 0)) {
-    SCS.Second = ICK_Zero_Queue_Conversion;
-    FromType = ToType;
   } else {
     // No second conversion required.
     SCS.Second = ICK_Identity;
@@ -5167,7 +5162,6 @@ static bool CheckConvertedConstantConversions(Sema &S,
   case ICK_Function_Conversion:
   case ICK_Integral_Promotion:
   case ICK_Integral_Conversion: // Narrowing conversions are checked elsewhere.
-  case ICK_Zero_Queue_Conversion:
     return true;
 
   case ICK_Boolean_Conversion:
diff --git a/test/CodeGenOpenCL/null_queue.cl b/test/CodeGenOpenCL/null_queue.cl
deleted file mode 100644 (file)
index cdcd7ee..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// RUN: %clang_cc1 -O0 -cl-std=CL2.0  -emit-llvm %s -o - | FileCheck %s
-extern queue_t get_default_queue();
-
-bool compare() {
-  return 0 == get_default_queue() &&
-         get_default_queue() == 0;
-  // CHECK: icmp eq %opencl.queue_t* null, %{{.*}}
-  // CHECK: icmp eq %opencl.queue_t* %{{.*}}, null
-}
-
-void func(queue_t q);
-
-void init() {
-  queue_t q = 0;
-  func(0);
-  // CHECK: store %opencl.queue_t* null, %opencl.queue_t** %q
-  // CHECK: call void @func(%opencl.queue_t* null)
-}
diff --git a/test/SemaOpenCL/null_queue.cl b/test/SemaOpenCL/null_queue.cl
deleted file mode 100644 (file)
index 518f713..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only
-extern queue_t get_default_queue();
-
-bool compare() {
-  return 1 == get_default_queue() && // expected-error{{invalid operands to binary expression ('int' and 'queue_t')}}
-         get_default_queue() == 1; // expected-error{{invalid operands to binary expression ('queue_t' and 'int')}}
-}
-
-void init() {
-  queue_t q1 = 1; // expected-error{{initializing 'queue_t' with an expression of incompatible type 'int'}}
-  queue_t q = 0;
-}
diff --git a/test/SemaOpenCL/queue_t_overload.cl b/test/SemaOpenCL/queue_t_overload.cl
deleted file mode 100644 (file)
index 0048895..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only
-
-void __attribute__((overloadable)) foo(queue_t, __local char *); // expected-note {{candidate function not viable: no known conversion from 'int' to 'queue_t' for 1st argument}} // expected-note {{candidate function}}
-void __attribute__((overloadable)) foo(queue_t, __local float *); // expected-note {{candidate function not viable: no known conversion from 'int' to 'queue_t' for 1st argument}} // expected-note {{candidate function}}
-
-void kernel ker(__local char *src1, __local float *src2, __global int *src3) {
-  queue_t q;
-  foo(q, src1);
-  foo(0, src2);
-  foo(q, src3); // expected-error {{call to 'foo' is ambiguous}}
-  foo(1, src3); // expected-error {{no matching function for call to 'foo'}}
-}