[llvm-commits] [125159] Fix arry ref size calculation.
dpatel at apple.com
dpatel at apple.com
Mon Mar 19 12:06:59 PDT 2007
Revision: 125159
Author: dpatel
Date: 2007-03-19 12:06:59 -0700 (Mon, 19 Mar 2007)
Log Message:
-----------
Fix arry ref size calculation. Patch by Duncan Sands.
Modified Paths:
--------------
apple-local/branches/llvm/gcc/llvm-convert.cpp
Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-03-19 08:51:20 UTC (rev 125158)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-03-19 19:06:59 UTC (rev 125159)
@@ -4562,9 +4562,8 @@
tree length = arrayLength(TREE_TYPE(Array));
if (length && !host_integerp(length, 1)) {
// Make sure that ArrayAddr is of type ElementTy*, then do a 2-index gep.
- tree ElTy = TREE_TYPE(TREE_TYPE(Array));
ArrayAddr = BitCastToType(ArrayAddr, PointerType::get(Type::Int8Ty));
- Value *Scale = Emit(TYPE_SIZE_UNIT(ElTy), 0);
+ Value *Scale = Emit(array_ref_element_size(exp), 0);
if (Scale->getType() != IntPtrTy)
Scale = CastToUIntType(Scale, IntPtrTy);
@@ -4595,7 +4594,7 @@
// float foo(int w, float A[][w], int g) { return A[g][0]; }
ArrayAddr = BitCastToType(ArrayAddr, PointerType::get(Type::Int8Ty));
- Value *TypeSize = Emit(TYPE_SIZE_UNIT(IndexedType), 0);
+ Value *TypeSize = Emit(array_ref_element_size(exp), 0);
if (TypeSize->getType() != IntPtrTy)
TypeSize = CastToUIntType(TypeSize, IntPtrTy);
More information about the llvm-commits
mailing list