From 8ee9204309edafc981db6cf71f282e071034b1a4 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 3 Nov 2003 01:29:41 +0000 Subject: [PATCH] Fix bug with zero sized casts git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9667 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/InstructionCombining.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index bbdfda3f76b..534ba5946e2 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -1552,7 +1552,7 @@ Instruction *InstCombiner::visitCastInst(CastInst &CI) { unsigned CastElTySize = TD->getTypeSize(CastElTy); // If the allocation is for an even multiple of the cast type size - if (AllocElTySize % CastElTySize == 0) { + if (CastElTySize && (AllocElTySize % CastElTySize == 0)) { Value *Amt = ConstantUInt::get(Type::UIntTy, AllocElTySize/CastElTySize); std::string Name = AI->getName(); AI->setName("");