summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LowerPacked.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-11-27 01:05:10 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-11-27 01:05:10 +0000
commit6c38f0bb071b864a6f2ae7b0cacad1b15f6e3d03 (patch)
tree49fc8d5bca4b3574ae62d6927eef8e54ec07afb2 /llvm/lib/Transforms/Scalar/LowerPacked.cpp
parentafbc00bc381d60d041d716e0f9b8a04aadb42d23 (diff)
downloadbcm5719-llvm-6c38f0bb071b864a6f2ae7b0cacad1b15f6e3d03.tar.gz
bcm5719-llvm-6c38f0bb071b864a6f2ae7b0cacad1b15f6e3d03.zip
For PR950:
The long awaited CAST patch. This introduces 12 new instructions into LLVM to replace the cast instruction. Corresponding changes throughout LLVM are provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the exception of 175.vpr which fails only on a slight floating point output difference. llvm-svn: 31931
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LowerPacked.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LowerPacked.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/Scalar/LowerPacked.cpp b/llvm/lib/Transforms/Scalar/LowerPacked.cpp
index ae8506e2fce..f02c40f4d8a 100644
--- a/llvm/lib/Transforms/Scalar/LowerPacked.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerPacked.cpp
@@ -212,11 +212,9 @@ void LowerPacked::visitLoadInst(LoadInst& LI)
PKT->getNumElements());
PointerType* APT = PointerType::get(AT);
- // Cast the packed type to an array
- Value* array = new CastInst(LI.getPointerOperand(),
- APT,
- LI.getName() + ".a",
- &LI);
+ // Cast the pointer to packed 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;
@@ -234,10 +232,8 @@ void LowerPacked::visitLoadInst(LoadInst& LI)
&LI);
// generate the new load and save the result in packedToScalar map
- values.push_back(new LoadInst(val,
- LI.getName()+"."+utostr(i),
- LI.isVolatile(),
- &LI));
+ values.push_back(new LoadInst(val, LI.getName()+"."+utostr(i),
+ LI.isVolatile(), &LI));
}
setValues(&LI,values);
@@ -286,11 +282,10 @@ void LowerPacked::visitStoreInst(StoreInst& SI)
PKT->getNumElements());
PointerType* APT = PointerType::get(AT);
- // cast the packed to an array type
- Value* array = new CastInst(SI.getPointerOperand(),
- APT,
- "store.ge.a.",
- &SI);
+ // 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()) &&
OpenPOWER on IntegriCloud