> On Jun 22, 2015, at 5:30 PM, Hal Finkel <[email protected]> wrote:
> 
> [+John]
> 
> Hi Uli,
> 
> -    CGF.Builder.CreateStore(Src, DstPtr, DstIsVolatile);
> +    llvm::StoreInst *SI = CGF.Builder.CreateStore(Src, DstPtr, 
> DstIsVolatile);
> +    SI->setAlignment(DstAlign.getQuantity());
>     return;
> 
> You can use CreateAlignedStore instead of CreateStore here (and in several 
> other places).
> 
> +    llvm::AllocaInst *Tmp = CGF.CreateTempAlloca(SrcTy);
> +    Tmp->setAlignment(DstAlign.getQuantity());
> 
> As follow-up, we should make CreateTempAlloca take an optional alignment. 
> Running:
> 
>  grep -r -A 2 CreateTempAlloca * | grep setAlign
> 
> reveals that this patten already occurs in several places.

Seems reasonable to me.

In the Swift frontend, I actually deleted the unaligned CreateLoad/CreateStore
methods from our IRBuilder subclass in an effort to avoid ever creating 
something
without alignment.  That would be a good goal to achieve in Clang as well.

John.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to