[PATCH] Allocate stack storage for .block_descriptor and captured self.
John McCall
rjmccall at apple.com
Thu Mar 7 13:40:37 PST 2013
On Mar 7, 2013, at 10:11 AM, Adrian Prantl <aprantl at apple.com> wrote:
> I think there is a bug in the existing code in lib/CodeGen/Blocks.cpp:1181
>
> unsigned align = getContext().getDeclAlign(variable).getQuantity();
>
> llvm::AllocaInst *alloca =
> CreateMemTemp(variable->getType(), "block.captured-const");
> alloca->setAlignment(align);
>
> Builder.CreateStore(capture.getConstant(), alloca, align);
>
> ^^^^^
>
> The third argument of IRBuilder::CreateStore() is the “volatile” flag.
> http://llvm.org/doxygen/classllvm_1_1IRBuilder.html
>
> I assume that “align” is usually nonzero — so it would likely output a "store volatile". Do you think that’s unintentional and it’s safe to replace it with false? Or is the volatile modifier needed here?
It's probably supposed to be a call to a CreateAlignedStore. The volatility is unintentional.
John.
More information about the cfe-commits
mailing list