From: Simon Pilgrim Date: Sat, 16 Oct 2021 10:07:00 +0000 (+0100) Subject: [ConstantFolding] Use getValueAPF const ref value where possible. NFC. X-Git-Tag: upstream/15.0.7~28454 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c18cf10a049506534de5efaed0e91e062866532a;p=platform%2Fupstream%2Fllvm.git [ConstantFolding] Use getValueAPF const ref value where possible. NFC. Don't copy the value if we can avoid it. --- diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 8666954..8718ba0 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -2014,7 +2014,7 @@ static Constant *ConstantFoldScalarCall1(StringRef Name, /// the host native double versions. Float versions are not called /// directly but for all these it is true (float)(f((double)arg)) == /// f(arg). Long double not supported yet. - APFloat APF = Op->getValueAPF(); + const APFloat &APF = Op->getValueAPF(); switch (IntrinsicID) { default: break; @@ -2320,12 +2320,12 @@ static Constant *ConstantFoldScalarCall2(StringRef Name, if (const auto *Op1 = dyn_cast(Operands[0])) { if (!Ty->isFloatingPointTy()) return nullptr; - APFloat Op1V = Op1->getValueAPF(); + const APFloat &Op1V = Op1->getValueAPF(); if (const auto *Op2 = dyn_cast(Operands[1])) { if (Op2->getType() != Op1->getType()) return nullptr; - APFloat Op2V = Op2->getValueAPF(); + const APFloat &Op2V = Op2->getValueAPF(); if (const auto *ConstrIntr = dyn_cast(Call)) { RoundingMode RM = getEvaluationRoundingMode(ConstrIntr);