From: Chris Lattner Date: Mon, 11 Sep 2006 21:43:16 +0000 (+0000) Subject: Fix PR905 and InstCombine/2006-09-11-EmptyStructCrash.ll X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=63d3220dae7e28116327f419c9b38b541eac1f32;p=oota-llvm.git 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 --- diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 0e6c1b1f2dd..6961806bcb7 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -5187,7 +5187,8 @@ Instruction *InstCombiner::visitCastInst(CastInst &CI) { Constant *ZeroUInt = Constant::getNullValue(Type::UIntTy); unsigned NumZeros = 0; while (SrcTy != DstTy && - isa(SrcTy) && !isa(SrcTy)) { + isa(SrcTy) && !isa(SrcTy) && + SrcTy->getNumContainedTypes() /* not "{}" */) { SrcTy = cast(SrcTy)->getTypeAtIndex(ZeroUInt); ++NumZeros; }