[PATCH] Allocate stack storage for .block_descriptor and captured self.
Adrian Prantl
aprantl at apple.com
Thu Mar 7 10:11:00 PST 2013
John,
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?
Adrian
More information about the cfe-commits
mailing list