[PATCH] D19662: [OpenCL] Fix bug in mergeTypes which causes equivalent types treated as different.

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 28 10:40:47 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL267906: [OpenCL] Fix bug in mergeTypes which causes equivalent types treated as… (authored by yaxunl).

Changed prior to commit:
  http://reviews.llvm.org/D19662?vs=55438&id=55440#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19662

Files:
  cfe/trunk/lib/AST/ASTContext.cpp
  cfe/trunk/test/CodeGenOpenCL/address-spaces-conversions.cl

Index: cfe/trunk/test/CodeGenOpenCL/address-spaces-conversions.cl
===================================================================
--- cfe/trunk/test/CodeGenOpenCL/address-spaces-conversions.cl
+++ cfe/trunk/test/CodeGenOpenCL/address-spaces-conversions.cl
@@ -63,7 +63,16 @@
   // CHECK: %{{.+}} = addrspacecast i32 addrspace(1)* %{{.+}} to i32 addrspace(4)*
   // CHECK: phi
   // CHECK: store
-  
+
+  typedef int int_t;
+  global int_t *var_glob_typedef;
+  var_gen = var_gen ? var_gen : var_glob_typedef; // operands of overlapping addr spaces and equivalent types
+  // CHECK: icmp
+  // CHECK-NOT: bitcast
+  // CHECK: %{{.+}} = addrspacecast i32 addrspace(1)* %{{.+}} to i32 addrspace(4)*
+  // CHECK: phi
+  // CHECK: store
+ 
   var_gen_v = var_gen ? var_gen : var_gen_f; // operands of the same addr space and different types
   // CHECK: icmp
   // CHECK: %{{.+}} = bitcast i32 addrspace(4)* %{{.+}} to i8 addrspace(4)*
Index: cfe/trunk/lib/AST/ASTContext.cpp
===================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp
+++ cfe/trunk/lib/AST/ASTContext.cpp
@@ -7618,7 +7618,7 @@
   Qualifiers RQuals = RHSCan.getLocalQualifiers();
   if (LQuals != RQuals) {
     if (getLangOpts().OpenCL) {
-      if (LHS.getUnqualifiedType() != RHS.getUnqualifiedType() ||
+      if (LHSCan.getUnqualifiedType() != RHSCan.getUnqualifiedType() ||
           LQuals.getCVRQualifiers() != RQuals.getCVRQualifiers())
         return QualType();
       if (LQuals.isAddressSpaceSupersetOf(RQuals))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19662.55440.patch
Type: text/x-patch
Size: 1538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160428/a47bf9a2/attachment.bin>


More information about the cfe-commits mailing list