[llvm-commits] [llvm-gcc-4.2] r42993 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-types.cpp
Devang Patel
dpatel at apple.com
Mon Oct 15 10:29:17 PDT 2007
Author: dpatel
Date: Mon Oct 15 12:29:14 2007
New Revision: 42993
URL: http://llvm.org/viewvc/llvm-project?rev=42993&view=rev
Log:
Fix
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071015/054529.html
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
llvm-gcc-4.2/trunk/gcc/llvm-types.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=42993&r1=42992&r2=42993&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Oct 15 12:29:14 2007
@@ -4838,13 +4838,20 @@
// 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;
+ if (VOID_TYPE_P(TREE_TYPE(ArrayType))) {
+ Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp");
+ return BitCastToType(Ptr, PointerType::get(Type::Int8Ty));
+ }
+ else {
+ TypeSize = Emit(array_ref_element_size(exp), 0);
+ TypeSize = CastToUIntType(TypeSize, IntPtrTy);
+ IndexVal = Builder.CreateMul(IndexVal, TypeSize, "tmp");
+ Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp");
+ return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp))));
+ }
- IndexVal = Builder.CreateMul(IndexVal, TypeSize, "tmp");
- Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp");
- return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp))));
}
/// getFieldOffsetInBits - Return the offset (in bits) of a FIELD_DECL in a
Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=42993&r1=42992&r2=42993&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Oct 15 12:29:14 2007
@@ -303,7 +303,7 @@
TREE_CODE(type) == REFERENCE_TYPE) && "not a sequential type!");
// This relies on gcc types with constant size mapping to LLVM types with the
// same size.
- return isInt64(TYPE_SIZE(TREE_TYPE(type)), true);
+ return !VOID_TYPE_P(TREE_TYPE(type)) && isInt64(TYPE_SIZE(TREE_TYPE(type)), true);
}
/// isArrayCompatible - Return true if the specified gcc array or pointer type
More information about the llvm-commits
mailing list