diff options
| author | Dan Gohman <gohman@apple.com> | 2007-10-29 20:34:35 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2007-10-29 20:34:35 +0000 |
| commit | 2aec186dd0ce32ebe6d3b47828cac723d1180583 (patch) | |
| tree | d3e673f9486f6642d3fc92c437184b29b3bd7459 /llvm/lib | |
| parent | 3bcd5fe9f12bc0f1837152592b2e5e93b414890d (diff) | |
| download | bcm5719-llvm-2aec186dd0ce32ebe6d3b47828cac723d1180583.tar.gz bcm5719-llvm-2aec186dd0ce32ebe6d3b47828cac723d1180583.zip | |
Don't bitcast from pointer-to-vector to pointer-to-array when
lowering load and store instructions.
llvm-svn: 43468
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LowerPacked.cpp | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/llvm/lib/Transforms/Scalar/LowerPacked.cpp b/llvm/lib/Transforms/Scalar/LowerPacked.cpp index 57ba86d0ab7..5e4d9eb89ac 100644 --- a/llvm/lib/Transforms/Scalar/LowerPacked.cpp +++ b/llvm/lib/Transforms/Scalar/LowerPacked.cpp @@ -217,15 +217,7 @@ void LowerPacked::visitLoadInst(LoadInst& LI) if (const VectorType* PKT = dyn_cast<VectorType>(LI.getType())) { // Initialization, Idx is needed for getelementptr needed later 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); + Idx[0] = ConstantInt::get(Type::Int32Ty, 0); // Convert this load into num elements number of loads std::vector<Value*> values; @@ -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), @@ -316,15 +308,7 @@ void LowerPacked::visitStoreInst(StoreInst& SI) dyn_cast<VectorType>(SI.getOperand(0)->getType())) { // We will need this for getelementptr 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); + Idx[0] = ConstantInt::get(Type::Int32Ty, 0); std::vector<Value*>& values = getValues(SI.getOperand(0)); @@ -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) + ".", |

