[llvm] [LAA] refactor sortPtrAccesses (NFC) (PR #92256)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 18:26:03 PDT 2024


================
@@ -1646,22 +1646,19 @@ bool llvm::sortPtrAccesses(ArrayRef<Value *> VL, Type *ElemTy,
 
     // Check if the pointer with the same offset is found.
     int64_t Offset = *Diff;
-    auto Res = Offsets.emplace(Offset, Cnt);
-    if (!Res.second)
+    auto [It, IsInserted] = Offsets.emplace(Offset, Cnt++);
----------------
nikic wrote:

I think the more idiomatic way to handle `Cnt` would be to loop over `enumerate()`.

https://github.com/llvm/llvm-project/pull/92256


More information about the llvm-commits mailing list