diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h index 168d9baa3a0..8af27c77c33 100644 --- a/lib/AsmParser/ParserInternals.h +++ b/lib/AsmParser/ParserInternals.h @@ -152,6 +152,8 @@ struct ValID { delete IAD; else if (Type == ConstAPInt) delete ConstPoolInt; + else if (Type == ConstFPVal) + delete ConstPoolFP; } inline ValID copy() const { diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index d76994a431a..36b827d6b72 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -437,7 +437,11 @@ static Value *getExistingVal(const Type *Ty, const ValID &D) { D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven, &ignored); } - return ConstantFP::get(*D.ConstPoolFP); + { + ConstantFP *tmp = ConstantFP::get(*D.ConstPoolFP); + D.destroy(); + return tmp; + } case ValID::ConstNullVal: // Is it a null value? if (!isa(Ty)) {