From 68e05fb3687ca68d5a5be49100c7c274a3185525 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Fri, 30 Sep 2011 19:58:46 +0000 Subject: [PATCH] Don't modify constant in-place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140875 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/InstCombine/InstCombineCompares.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp index 26432d2eed5..bb1cbfade34 100644 --- a/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -2839,10 +2839,11 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) { // Avoid lossy conversions and denormals. Zero is a special case // that's OK to convert. - F.clearSign(); + APFloat Fabs = F; + Fabs.clearSign(); if (!Lossy && - ((F.compare(APFloat::getSmallestNormalized(*Sem)) != - APFloat::cmpLessThan) || F.isZero())) + ((Fabs.compare(APFloat::getSmallestNormalized(*Sem)) != + APFloat::cmpLessThan) || Fabs.isZero())) return new FCmpInst(I.getPredicate(), LHSExt->getOperand(0), ConstantFP::get(RHSC->getContext(), F));