[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:24:26 PDT 2016


yaxunl updated this revision to Diff 55438.
yaxunl added a comment.

Removed accidentally inserted blanks.


http://reviews.llvm.org/D19662

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

Index: test/CodeGenOpenCL/address-spaces-conversions.cl
===================================================================
--- test/CodeGenOpenCL/address-spaces-conversions.cl
+++ 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: lib/AST/ASTContext.cpp
===================================================================
--- lib/AST/ASTContext.cpp
+++ 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.55438.patch
Type: text/x-patch
Size: 1478 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160428/f624bd29/attachment.bin>


More information about the cfe-commits mailing list