[llvm-commits] [llvm-gcc-4.2] r42993 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-types.cpp

Duncan Sands baldrick at free.fr
Mon Oct 15 11:03:33 PDT 2007


Hi Devang,

>    //   float foo(int w, float A[][w], int g) { return A[g][0]; }
>  
>    ArrayAddr = BitCastToType(ArrayAddr, PointerType::get(Type::Int8Ty));
> -  Value *TypeSize = Emit(array_ref_element_size(exp), 0);
> -  TypeSize = CastToUIntType(TypeSize, IntPtrTy);
> +  Value *TypeSize = NULL;

since TypeSize is only used in the second branch of the "if", it could be
declared there.

> +  if (VOID_TYPE_P(TREE_TYPE(ArrayType))) {
> +    Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp");
> +    return BitCastToType(Ptr, PointerType::get(Type::Int8Ty));

If ArrayAddr is not an i8*, then the CreateGEP line is wrong, so
this bitcast should be useless.

Ciao,

Duncan.




More information about the llvm-commits mailing list