Don't modify constant in-place.

llvm-svn: 140875
This commit is contained in:
Jim Grosbach 2011-09-30 19:58:46 +00:00
parent 2f0cbf6a99
commit 011dafba61
1 changed files with 4 additions and 3 deletions

View File

@ -2839,10 +2839,11 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
// Avoid lossy conversions and denormals. Zero is a special case // Avoid lossy conversions and denormals. Zero is a special case
// that's OK to convert. // that's OK to convert.
F.clearSign(); APFloat Fabs = F;
Fabs.clearSign();
if (!Lossy && if (!Lossy &&
((F.compare(APFloat::getSmallestNormalized(*Sem)) != ((Fabs.compare(APFloat::getSmallestNormalized(*Sem)) !=
APFloat::cmpLessThan) || F.isZero())) APFloat::cmpLessThan) || Fabs.isZero()))
return new FCmpInst(I.getPredicate(), LHSExt->getOperand(0), return new FCmpInst(I.getPredicate(), LHSExt->getOperand(0),
ConstantFP::get(RHSC->getContext(), F)); ConstantFP::get(RHSC->getContext(), F));