diff options
author | Jannik Silvanus <jannik.silvanus@amd.com> | 2023-12-12 11:20:27 +0100 |
---|---|---|
committer | Jannik Silvanus <jannik.silvanus@amd.com> | 2023-12-14 10:13:32 +0100 |
commit | 3e8b175eec6fef1a073fb7d0d867fbc6a7837f57 (patch) | |
tree | 7ac3592efb1bfd5059a8e54041d650070ace3f03 /llvm/lib/IR | |
parent | f69c83f8dabf4785b7075da4811ab5122b5043ce (diff) | |
download | llvm-3e8b175eec6fef1a073fb7d0d867fbc6a7837f57.zip llvm-3e8b175eec6fef1a073fb7d0d867fbc6a7837f57.tar.gz llvm-3e8b175eec6fef1a073fb7d0d867fbc6a7837f57.tar.bz2 |
[IR] Avoid redundant map lookup [NFC]
Use the iterator returned by MapVector::insert to update
the value in the map, instead of a second redundant map lookup.
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r-- | llvm/lib/IR/Operator.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/Operator.cpp b/llvm/lib/IR/Operator.cpp index 017641a..cd982c7 100644 --- a/llvm/lib/IR/Operator.cpp +++ b/llvm/lib/IR/Operator.cpp @@ -229,8 +229,8 @@ bool GEPOperator::collectOffset( // Insert an initial offset of 0 for V iff none exists already, then // increment the offset by IndexedSize. if (!IndexedSize.isZero()) { - VariableOffsets.insert({V, APInt(BitWidth, 0)}); - VariableOffsets[V] += IndexedSize; + auto *It = VariableOffsets.insert({V, APInt(BitWidth, 0)}).first; + It->second += IndexedSize; } } return true; |