diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-10-24 06:26:32 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-10-24 06:26:32 +0000 |
| commit | ebb1ad4382c1e8cf83e2f716436256dd8e12553f (patch) | |
| tree | 757c4f269973a20f26df93e33b14f6afac33ef65 /llvm/lib | |
| parent | 793dab3c9cc34135e23b21a37ef5fed3d457cb2f (diff) | |
| download | bcm5719-llvm-ebb1ad4382c1e8cf83e2f716436256dd8e12553f.tar.gz bcm5719-llvm-ebb1ad4382c1e8cf83e2f716436256dd8e12553f.zip | |
Fix Transforms/ScalarRepl/2006-10-23-PointerUnionCrash.ll
llvm-svn: 31151
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 496449f4946..ffb095a0481 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -611,11 +611,16 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { NV = new ExtractElementInst(NV, ConstantInt::get(Type::UIntTy, Elt), "tmp", LI); } else { - assert(NV->getType()->isInteger() && "Unknown promotion!"); - if (Offset && Offset < TD.getTypeSize(NV->getType())*8) - NV = new ShiftInst(Instruction::Shr, NV, - ConstantInt::get(Type::UByteTy, Offset), - LI->getName(), LI); + if (Offset) { + assert(NV->getType()->isInteger() && "Unknown promotion!"); + if (Offset < TD.getTypeSize(NV->getType())*8) + NV = new ShiftInst(Instruction::Shr, NV, + ConstantInt::get(Type::UByteTy, Offset), + LI->getName(), LI); + } else { + assert((NV->getType()->isInteger() || + isa<PointerType>(NV->getType())) && "Unknown promotion!"); + } NV = new CastInst(NV, LI->getType(), LI->getName(), LI); } } |

