[llvm] 4ff4708 - collectBitParts - use const references. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 14 10:28:22 PDT 2020
Author: Simon Pilgrim
Date: 2020-09-14T18:23:00+01:00
New Revision: 4ff4708d39b790bf7231ad0fa4e7cfddb4e26f95
URL: https://github.com/llvm/llvm-project/commit/4ff4708d39b790bf7231ad0fa4e7cfddb4e26f95
DIFF: https://github.com/llvm/llvm-project/commit/4ff4708d39b790bf7231ad0fa4e7cfddb4e26f95.diff
LOG: collectBitParts - use const references. NFCI.
Fixes clang-tidy warnings first noticed on D87452.
Added:
Modified:
llvm/lib/Transforms/Utils/Local.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 41349457e2b9..0b848feddf8e 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2795,10 +2795,10 @@ collectBitParts(Value *V, bool MatchBSwaps, bool MatchBitReversals,
if (Instruction *I = dyn_cast<Instruction>(V)) {
// If this is an or instruction, it may be an inner node of the bswap.
if (I->getOpcode() == Instruction::Or) {
- auto &A = collectBitParts(I->getOperand(0), MatchBSwaps,
- MatchBitReversals, BPS, Depth + 1);
- auto &B = collectBitParts(I->getOperand(1), MatchBSwaps,
- MatchBitReversals, BPS, Depth + 1);
+ const auto &A = collectBitParts(I->getOperand(0), MatchBSwaps,
+ MatchBitReversals, BPS, Depth + 1);
+ const auto &B = collectBitParts(I->getOperand(1), MatchBSwaps,
+ MatchBitReversals, BPS, Depth + 1);
if (!A || !B)
return Result;
@@ -2830,8 +2830,8 @@ collectBitParts(Value *V, bool MatchBSwaps, bool MatchBitReversals,
if (BitShift > BitWidth)
return Result;
- auto &Res = collectBitParts(I->getOperand(0), MatchBSwaps,
- MatchBitReversals, BPS, Depth + 1);
+ const auto &Res = collectBitParts(I->getOperand(0), MatchBSwaps,
+ MatchBitReversals, BPS, Depth + 1);
if (!Res)
return Result;
Result = Res;
@@ -2862,8 +2862,8 @@ collectBitParts(Value *V, bool MatchBSwaps, bool MatchBitReversals,
if (!MatchBitReversals && NumMaskedBits % 8 != 0)
return Result;
- auto &Res = collectBitParts(I->getOperand(0), MatchBSwaps,
- MatchBitReversals, BPS, Depth + 1);
+ const auto &Res = collectBitParts(I->getOperand(0), MatchBSwaps,
+ MatchBitReversals, BPS, Depth + 1);
if (!Res)
return Result;
Result = Res;
@@ -2877,8 +2877,8 @@ collectBitParts(Value *V, bool MatchBSwaps, bool MatchBitReversals,
// If this is a zext instruction zero extend the result.
if (I->getOpcode() == Instruction::ZExt) {
- auto &Res = collectBitParts(I->getOperand(0), MatchBSwaps,
- MatchBitReversals, BPS, Depth + 1);
+ const auto &Res = collectBitParts(I->getOperand(0), MatchBSwaps,
+ MatchBitReversals, BPS, Depth + 1);
if (!Res)
return Result;
More information about the llvm-commits
mailing list