This should also be safe to apply to 4.0, right? -Chris
On Sep 25, 2007, at 1:12 PM, Duncan Sands wrote: > Author: baldrick > Date: Tue Sep 25 15:12:14 2007 > New Revision: 42315 > > URL: http://llvm.org/viewvc/llvm-project?rev=42315&view=rev > Log: > Handle scalar to aggregate VIEW_CONVERT_EXPR lvalue. > > Modified: > llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp > > Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ > llvm-convert.cpp?rev=42315&r1=42314&r2=42315&view=diff > > ====================================================================== > ======== > --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) > +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Sep 25 15:12:14 2007 > @@ -5068,12 +5068,22 @@ > } > > LValue TreeToLLVM::EmitLV_VIEW_CONVERT_EXPR(tree exp) { > - // The address is the address of the operand. > - LValue LV = EmitLV(TREE_OPERAND(exp, 0)); > - // The type is the type of the expression. > - const Type *Ty = ConvertType(TREE_TYPE(exp)); > - LV.Ptr = BitCastToType(LV.Ptr, PointerType::get(Ty)); > - return LV; > + tree Op = TREE_OPERAND(exp, 0); > + > + if (isAggregateTreeType(TREE_TYPE(Op))) { > + // If the input is an aggregate, the address is the address of > the operand. > + LValue LV = EmitLV(Op); > + // The type is the type of the expression. > + LV.Ptr = BitCastToType(LV.Ptr, PointerType::get(ConvertType > (TREE_TYPE(exp)))); > + return LV; > + } else { > + // If the input is a scalar, emit to a temporary. > + Value *Dest = CreateTemporary(ConvertType(TREE_TYPE(Op))); > + Builder.CreateStore(Emit(Op, 0), Dest); > + // The type is the type of the expression. > + Dest = BitCastToType(Dest, PointerType::get(ConvertType > (TREE_TYPE(exp)))); > + return LValue(Dest); > + } > } > > LValue TreeToLLVM::EmitLV_EXC_PTR_EXPR(tree exp) { > > > _______________________________________________ > llvm-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits _______________________________________________ llvm-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
