[llvm] c18cf10 - [ConstantFolding] Use getValueAPF const ref value where possible. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 16 03:53:34 PDT 2021
Author: Simon Pilgrim
Date: 2021-10-16T11:20:19+01:00
New Revision: c18cf10a049506534de5efaed0e91e062866532a
URL: https://github.com/llvm/llvm-project/commit/c18cf10a049506534de5efaed0e91e062866532a
DIFF: https://github.com/llvm/llvm-project/commit/c18cf10a049506534de5efaed0e91e062866532a.diff
LOG: [ConstantFolding] Use getValueAPF const ref value where possible. NFC.
Don't copy the value if we can avoid it.
Added:
Modified:
llvm/lib/Analysis/ConstantFolding.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 8666954d611e..8718ba04254f 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<ConstantFP>(Operands[0])) {
if (!Ty->isFloatingPointTy())
return nullptr;
- APFloat Op1V = Op1->getValueAPF();
+ const APFloat &Op1V = Op1->getValueAPF();
if (const auto *Op2 = dyn_cast<ConstantFP>(Operands[1])) {
if (Op2->getType() != Op1->getType())
return nullptr;
- APFloat Op2V = Op2->getValueAPF();
+ const APFloat &Op2V = Op2->getValueAPF();
if (const auto *ConstrIntr = dyn_cast<ConstrainedFPIntrinsic>(Call)) {
RoundingMode RM = getEvaluationRoundingMode(ConstrIntr);
More information about the llvm-commits
mailing list