[cfe-commits] [PATCH] struct{bool} -> int function argument coercion emits an invalid store on ARM
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Thu Feb 9 00:19:51 PST 2012
Thanks for taking a look!
Comments inline, new patch attached.
On Thu, Feb 9, 2012 at 9:34 AM, Eli Friedman <eli.friedman at gmail.com> wrote:
> Indentation generally looks strange... maybe some stray tabs?
Fixed.
> + llvm::Value *Casted =
> + Builder.CreateBitCast(TempAlloca,
> llvm::PointerType::getUnqual(ConvertTypeForMem(Ty)));
> + llvm::LoadInst *Load = Builder.CreateLoad(Casted);
> + Builder.CreateStore(Load, Ptr);
>
> Please use memcpy to copy structs, not load+store.
Done.
> - if (llvm::StructType *STy =
> - dyn_cast<llvm::StructType>(ArgI.getCoerceToType())) {
> - Ptr = Builder.CreateBitCast(Ptr, llvm::PointerType::getUnqual(STy));
> + llvm::StructType *STy =
> dyn_cast<llvm::StructType>(ArgI.getCoerceToType());
> + if (STy && STy->getNumElements() > 1) {
>
> For the case where STy->getNumElements() == 1, do we avoid storing a
> struct type? If not, can you fix that?
Yes, as far as I can see. We go into CreateCoercedStore, then
EnterStructPointerForCoercedAccess.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arg.patch
Type: text/x-patch
Size: 3514 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120209/ed0d739f/attachment.bin>
More information about the cfe-commits
mailing list