[PATCH] D39184: CodeGen: Fix invalid bitcast in partial initialization of automatic arrary variable

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 23 10:50:43 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL316353: CodeGen: Fix invalid bitcast in partial initialization of automatic arrary… (authored by yaxunl).

Changed prior to commit:
  https://reviews.llvm.org/D39184?vs=119861&id=119900#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39184

Files:
  cfe/trunk/lib/CodeGen/CGDecl.cpp
  cfe/trunk/test/CodeGenOpenCL/amdgcn-automatic-variable.cl


Index: cfe/trunk/lib/CodeGen/CGDecl.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp
@@ -1266,7 +1266,7 @@
     llvm::ConstantInt::get(IntPtrTy,
                            getContext().getTypeSizeInChars(type).getQuantity());
 
-  llvm::Type *BP = Int8PtrTy;
+  llvm::Type *BP = AllocaInt8PtrTy;
   if (Loc.getType() != BP)
     Loc = Builder.CreateBitCast(Loc, BP);
 
Index: cfe/trunk/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
===================================================================
--- cfe/trunk/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
+++ cfe/trunk/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
@@ -58,3 +58,11 @@
   const int lvc = 4;
   lv1 = lvc;
 }
+
+// CHECK-LABEL: define void @func3()
+// CHECK: %a = alloca [16 x [1 x float]], align 4, addrspace(5)
+// CHECK: %[[CAST:.+]] = bitcast [16 x [1 x float]] addrspace(5)* %a to i8 addrspace(5)*
+// CHECK: call void @llvm.memset.p5i8.i64(i8 addrspace(5)* %[[CAST]], i8 0, i64 64, i32 4, i1 false)
+void func3(void) {
+  float a[16][1] = {{0.}};
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39184.119900.patch
Type: text/x-patch
Size: 1130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171023/ab059c0e/attachment.bin>


More information about the cfe-commits mailing list