diff options
author | Chris Lattner <sabre@nondot.org> | 2007-04-11 15:45:25 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-04-11 15:45:25 +0000 |
commit | 5ee4d0726aef5c484e6e90170bd16aceb8a717e0 (patch) | |
tree | f21d6d21cba0d76ee05977708bb5e58c22033201 /llvm/lib/Transforms | |
parent | 83b53a59646d859776f818278ae9fef4daaff727 (diff) | |
download | bcm5719-llvm-5ee4d0726aef5c484e6e90170bd16aceb8a717e0.tar.gz bcm5719-llvm-5ee4d0726aef5c484e6e90170bd16aceb8a717e0.zip |
Fix Transforms/ScalarRepl/union-pointer.ll
llvm-svn: 35906
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index ad34012c45f..057bc6f5c9b 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -1002,6 +1002,11 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { ConstantInt::get(Type::Int32Ty, Elt), "tmp", SI); } + } else if (isa<PointerType>(AllocaType)) { + // If the alloca type is a pointer, then all the elements must be + // pointers. + if (SV->getType() != AllocaType) + SV = new BitCastInst(SV, AllocaType, SV->getName(), SI); } else { Value *Old = new LoadInst(NewAI, NewAI->getName()+".in", SI); @@ -1013,12 +1018,8 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { if (SV->getType()->isFloatingPoint()) SV = new BitCastInst(SV, IntegerType::get(SrcWidth), SV->getName(), SI); - else if (isa<PointerType>(SV->getType())) { - if (isa<PointerType>(AllocaType)) - SV = new BitCastInst(SV, AllocaType, SV->getName(), SI); - else - SV = new PtrToIntInst(SV, TD.getIntPtrType(), SV->getName(), SI); - } + else if (isa<PointerType>(SV->getType())) + SV = new PtrToIntInst(SV, TD.getIntPtrType(), SV->getName(), SI); // Always zero extend the value if needed. if (SV->getType() != AllocaType) |