Don't bitcast from pointer-to-vector to pointer-to-array when

lowering load and store instructions.

llvm-svn: 43468
This commit is contained in:
Dan Gohman 2007-10-29 20:34:35 +00:00
parent 3bcd5fe9f1
commit 2aec186dd0
1 changed files with 4 additions and 20 deletions

View File

@ -219,14 +219,6 @@ void LowerPacked::visitLoadInst(LoadInst& LI)
Value *Idx[2];
Idx[0] = ConstantInt::get(Type::Int32Ty, 0);
ArrayType* AT = ArrayType::get(PKT->getContainedType(0),
PKT->getNumElements());
PointerType* APT = PointerType::get(AT);
// Cast the pointer to vector type to an equivalent array
Value* array = new BitCastInst(LI.getPointerOperand(), APT,
LI.getName() + ".a", &LI);
// Convert this load into num elements number of loads
std::vector<Value*> values;
values.reserve(PKT->getNumElements());
@ -236,7 +228,7 @@ void LowerPacked::visitLoadInst(LoadInst& LI)
Idx[1] = ConstantInt::get(Type::Int32Ty,i);
// Get the pointer
Value* val = new GetElementPtrInst(array,
Value* val = new GetElementPtrInst(LI.getPointerOperand(),
Idx, array_endof(Idx),
LI.getName() +
".ge." + utostr(i),
@ -318,14 +310,6 @@ void LowerPacked::visitStoreInst(StoreInst& SI)
Value *Idx[2];
Idx[0] = ConstantInt::get(Type::Int32Ty, 0);
ArrayType* AT = ArrayType::get(PKT->getContainedType(0),
PKT->getNumElements());
PointerType* APT = PointerType::get(AT);
// Cast the pointer to packed to an array of equivalent type
Value* array = new BitCastInst(SI.getPointerOperand(), APT,
"store.ge.a.", &SI);
std::vector<Value*>& values = getValues(SI.getOperand(0));
assert((values.size() == PKT->getNumElements()) &&
@ -334,7 +318,7 @@ void LowerPacked::visitStoreInst(StoreInst& SI)
for (unsigned i = 0, e = PKT->getNumElements(); i != e; ++i) {
// Generate the indices for getelementptr
Idx[1] = ConstantInt::get(Type::Int32Ty,i);
Value* val = new GetElementPtrInst(array,
Value* val = new GetElementPtrInst(SI.getPointerOperand(),
Idx, array_endof(Idx),
"store.ge." +
utostr(i) + ".",