[llvm] ddab4cd - [KnownBits] Avoid some copies (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 13:19:54 PDT 2020
Author: Nikita Popov
Date: 2020-09-07T22:19:29+02:00
New Revision: ddab4cd83ea31141aaada424dccf94278482ee88
URL: https://github.com/llvm/llvm-project/commit/ddab4cd83ea31141aaada424dccf94278482ee88
DIFF: https://github.com/llvm/llvm-project/commit/ddab4cd83ea31141aaada424dccf94278482ee88.diff
LOG: [KnownBits] Avoid some copies (NFC)
These lambdas don't need copies, use const reference.
Added:
Modified:
llvm/lib/Support/KnownBits.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/KnownBits.cpp b/llvm/lib/Support/KnownBits.cpp
index aad50e124034..03843687c10a 100644
--- a/llvm/lib/Support/KnownBits.cpp
+++ b/llvm/lib/Support/KnownBits.cpp
@@ -115,13 +115,13 @@ KnownBits KnownBits::umax(const KnownBits &LHS, const KnownBits &RHS) {
KnownBits KnownBits::umin(const KnownBits &LHS, const KnownBits &RHS) {
// Flip the range of values: [0, 0xFFFFFFFF] <-> [0xFFFFFFFF, 0]
- auto Flip = [](KnownBits Val) { return KnownBits(Val.One, Val.Zero); };
+ auto Flip = [](const KnownBits &Val) { return KnownBits(Val.One, Val.Zero); };
return Flip(umax(Flip(LHS), Flip(RHS)));
}
KnownBits KnownBits::smax(const KnownBits &LHS, const KnownBits &RHS) {
// Flip the range of values: [-0x80000000, 0x7FFFFFFF] <-> [0, 0xFFFFFFFF]
- auto Flip = [](KnownBits Val) {
+ auto Flip = [](const KnownBits &Val) {
unsigned SignBitPosition = Val.getBitWidth() - 1;
APInt Zero = Val.Zero;
APInt One = Val.One;
@@ -134,7 +134,7 @@ KnownBits KnownBits::smax(const KnownBits &LHS, const KnownBits &RHS) {
KnownBits KnownBits::smin(const KnownBits &LHS, const KnownBits &RHS) {
// Flip the range of values: [-0x80000000, 0x7FFFFFFF] <-> [0xFFFFFFFF, 0]
- auto Flip = [](KnownBits Val) {
+ auto Flip = [](const KnownBits &Val) {
unsigned SignBitPosition = Val.getBitWidth() - 1;
APInt Zero = Val.One;
APInt One = Val.Zero;
More information about the llvm-commits
mailing list