[llvm] 03fe47a - ConstantFoldScalarCall3 - use const APInt& returned by getValue()
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 9 03:17:14 PDT 2020
Author: Simon Pilgrim
Date: 2020-07-09T11:16:47+01:00
New Revision: 03fe47a29c95dbda5ecd548e35627bb16f7dfc6d
URL: https://github.com/llvm/llvm-project/commit/03fe47a29c95dbda5ecd548e35627bb16f7dfc6d
DIFF: https://github.com/llvm/llvm-project/commit/03fe47a29c95dbda5ecd548e35627bb16f7dfc6d.diff
LOG: ConstantFoldScalarCall3 - use const APInt& returned by getValue()
Avoids unnecessary APInt copies and silences clang tidy warning.
Added:
Modified:
llvm/lib/Analysis/ConstantFolding.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 76e7b2906c91..a414336fb21b 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -2607,8 +2607,8 @@ static Constant *ConstantFoldScalarCall3(StringRef Name,
// how rounding should be done, and provide their own folding to be
// consistent with rounding. This is the same approach as used by
// DAGTypeLegalizer::ExpandIntRes_MULFIX.
- APInt Lhs = Op1->getValue();
- APInt Rhs = Op2->getValue();
+ const APInt &Lhs = Op1->getValue();
+ const APInt &Rhs = Op2->getValue();
unsigned Scale = Op3->getValue().getZExtValue();
unsigned Width = Lhs.getBitWidth();
assert(Scale < Width && "Illegal scale.");
More information about the llvm-commits
mailing list