summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-09-11 21:43:16 +0000
committerChris Lattner <sabre@nondot.org>2006-09-11 21:43:16 +0000
commitd28627009a678abf20ba3b286a985043c393a756 (patch)
tree862a6baf929a10d1f969627b43b5963596e5087b /llvm/lib/Transforms/Scalar
parent3faf86e4f4767f7c8b4e308ee6a60b83272d36e3 (diff)
downloadbcm5719-llvm-d28627009a678abf20ba3b286a985043c393a756.tar.gz
bcm5719-llvm-d28627009a678abf20ba3b286a985043c393a756.zip
Fix PR905 and InstCombine/2006-09-11-EmptyStructCrash.ll
llvm-svn: 30266
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 0e6c1b1f2dd..6961806bcb7 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/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<CompositeType>(SrcTy) && !isa<PointerType>(SrcTy)) {
+ isa<CompositeType>(SrcTy) && !isa<PointerType>(SrcTy) &&
+ SrcTy->getNumContainedTypes() /* not "{}" */) {
SrcTy = cast<CompositeType>(SrcTy)->getTypeAtIndex(ZeroUInt);
++NumZeros;
}
OpenPOWER on IntegriCloud