Fix bug in mask selection for references.

We should always use the full mask when storing to a reference, since we
don't in general know what it refers to (and thence the appropriate mask
to use for its target).
This commit is contained in:
Matt Pharr
2011-12-14 16:18:10 -08:00
parent 9920b30318
commit c0b41ad6f5

View File

@@ -638,10 +638,12 @@ lLLVMConstantValue(const Type *type, llvm::LLVMContext *ctx, double value) {
static llvm::Value * static llvm::Value *
lMaskForSymbol(Symbol *baseSym, FunctionEmitContext *ctx) { lMaskForSymbol(Symbol *baseSym, FunctionEmitContext *ctx) {
if (dynamic_cast<const PointerType *>(baseSym->type) != NULL) if (dynamic_cast<const PointerType *>(baseSym->type) != NULL ||
// FIXME: we really only want to do this for dereferencing the dynamic_cast<const ReferenceType *>(baseSym->type) != NULL)
// pointer, not for things like pointer arithmetic, when we may be // FIXME: for pointers, we really only want to do this for
// able to use the internal mask, depending on context... // dereferencing the pointer, not for things like pointer
// arithmetic, when we may be able to use the internal mask,
// depending on context...
return ctx->GetFullMask(); return ctx->GetFullMask();
llvm::Value *mask = (baseSym->parentFunction == ctx->GetFunction() && llvm::Value *mask = (baseSym->parentFunction == ctx->GetFunction() &&