Fix PR905 and InstCombine/2006-09-11-EmptyStructCrash.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30266 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-09-11 21:43:16 +00:00
parent c42354904e
commit 63d3220dae

View File

@ -5187,7 +5187,8 @@ Instruction *InstCombiner::visitCastInst(CastInst &CI) {
Constant *ZeroUInt = Constant::getNullValue(Type::UIntTy);
unsigned NumZeros = 0;
while (SrcTy != DstTy &&
isa<CompositeType>(SrcTy) && !isa<PointerType>(SrcTy)) {
isa<CompositeType>(SrcTy) && !isa<PointerType>(SrcTy) &&
SrcTy->getNumContainedTypes() /* not "{}" */) {
SrcTy = cast<CompositeType>(SrcTy)->getTypeAtIndex(ZeroUInt);
++NumZeros;
}