rjmccall added a comment.

In https://reviews.llvm.org/D47099#1105574, @yaxunl wrote:

> In https://reviews.llvm.org/D47099#1105493, @rjmccall wrote:
>
> > Maybe there should just be a method that makes a primitive alloca without 
> > the casting, and then you can call that in CreateTempAlloca.
>
>
> In many cases we still need to call CreateTempAlloca with cast enabled, since 
> we are not certain there is only load from it and store to it. Any time it is 
> stored to another memory location or passed to another function (e.g. 
> constructor/destructor), it needs to be a pointer to  the language's default 
> address space since the language sees it that way.


Yes, I understand that.  But there are some cases, like this, that do not need 
to produce something in `LangAS::Default`, and extracting out a method that 
just does an `alloca` without the unnecessary cast seems sensible.

> An alternative fix would be just let ActiveFlag to be llvm::Value instead of 
> llvm::AllocaInst, since it does not really need to be an AllocaInst.

I don't care at all about the type of `ActiveFlag`, but if we can generate 
better code at -O0 by avoiding the casts in situations where we obviously don't 
need them, we should do it.


https://reviews.llvm.org/D47099



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to