[PATCH] D40806: CodeGen: Fix invalid bitcasts for memcpy

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 6 21:01:03 PST 2017


rjmccall added inline comments.


================
Comment at: cfe/trunk/lib/CodeGen/CGCall.cpp:1238
+  Address Casted = CGF.Builder.CreateBitCast(Tmp, CGF.AllocaInt8PtrTy);
+  Address SrcCasted = CGF.Builder.CreateBitCast(Src, CGF.AllocaInt8PtrTy);
   CGF.Builder.CreateMemCpy(Casted, SrcCasted,
----------------
There is a CreateElementBitCast method on CGBuilderTy that preserves the source address space; that seems like the obviously correct fix here instead of assuming any specific address space on either operand.


================
Comment at: cfe/trunk/lib/CodeGen/CGCall.cpp:1320
+    Address Casted = CGF.Builder.CreateBitCast(Tmp, CGF.AllocaInt8PtrTy);
+    Address DstCasted = CGF.Builder.CreateBitCast(Dst, CGF.AllocaInt8PtrTy);
     CGF.Builder.CreateMemCpy(DstCasted, Casted,
----------------
Same.


Repository:
  rL LLVM

https://reviews.llvm.org/D40806





More information about the cfe-commits mailing list