IRgen: Fix some CreateTempAlloca calls to use ConvertTypeForMem when that is

conceptually correct. Review appreciated (Chris, Eli, Anders).

llvm-svn: 95401
This commit is contained in:
Daniel Dunbar 2010-02-05 18:56:49 +00:00
parent cb86e1088a
commit 8848175547
4 changed files with 9 additions and 6 deletions

View File

@ -657,7 +657,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
// Unknown builtin, for now just dump it out and return undef.
if (hasAggregateLLVMType(E->getType()))
return RValue::getAggregate(CreateTempAlloca(ConvertType(E->getType())));
return RValue::getAggregate(CreateTempAlloca(ConvertTypeForMem(
E->getType())));
return RValue::get(llvm::UndefValue::get(ConvertType(E->getType())));
}

View File

@ -1359,7 +1359,8 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) {
llvm::Value *Vec = EmitScalarExpr(E->getBase());
// Store the vector to memory (because LValue wants an address).
llvm::Value *VecMem =CreateTempAlloca(ConvertType(E->getBase()->getType()));
llvm::Value *VecMem = CreateTempAlloca(ConvertTypeForMem(
E->getBase()->getType()));
Builder.CreateStore(Vec, VecMem);
Base = LValue::MakeAddr(VecMem, Qualifiers());
}

View File

@ -163,7 +163,7 @@ CodeGenFunction::EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E,
// Get the member function pointer.
llvm::Value *MemFnPtr =
CreateTempAlloca(ConvertType(MemFnExpr->getType()), "mem.fn");
CreateTempAlloca(ConvertTypeForMem(MemFnExpr->getType()), "mem.fn");
EmitAggExpr(MemFnExpr, MemFnPtr, /*VolatileDest=*/false);
// Emit the 'this' pointer.

View File

@ -450,8 +450,8 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){
// Fast enumeration state.
QualType StateTy = getContext().getObjCFastEnumerationStateType();
llvm::AllocaInst *StatePtr = CreateTempAlloca(ConvertType(StateTy),
"state.ptr");
llvm::AllocaInst *StatePtr = CreateTempAlloca(ConvertTypeForMem(
StateTy), "state.ptr");
StatePtr->setAlignment(getContext().getTypeAlign(StateTy) >> 3);
EmitMemSetToZero(StatePtr, StateTy);
@ -470,7 +470,8 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){
getContext().getConstantArrayType(getContext().getObjCIdType(),
llvm::APInt(32, NumItems),
ArrayType::Normal, 0);
llvm::Value *ItemsPtr = CreateTempAlloca(ConvertType(ItemsTy), "items.ptr");
llvm::Value *ItemsPtr = CreateTempAlloca(ConvertTypeForMem(
ItemsTy), "items.ptr");
llvm::Value *Collection = EmitScalarExpr(S.getCollection());