Index: CodeGen/CGExprScalar.cpp =================================================================== --- CodeGen/CGExprScalar.cpp (revision 46389) +++ CodeGen/CGExprScalar.cpp (working copy) @@ -315,7 +315,11 @@ if (llvm::ZExtInst *ZI = dyn_cast(Src)) { if (ZI->getOperand(0)->getType() == llvm::Type::Int1Ty) { Value *Result = ZI->getOperand(0); - ZI->eraseFromParent(); + // If there aren't any more uses, zap the instruction to save space. + // Note that there can be more uses, for example if this + // is the result of an assignment. + if (ZI->use_empty()) + ZI->eraseFromParent(); return Result; } }