[PATCH] D159526: [CodeLayout] Refactor some std::vector and nested std::pair uses. NFC

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 11:20:06 PDT 2023


dblaikie added inline comments.


================
Comment at: llvm/include/llvm/Transforms/Utils/CodeLayout.h:27
 using EdgeT = std::pair<uint64_t, uint64_t>;
-using EdgeCountT = std::pair<EdgeT, uint64_t>;
+using EdgeCountT = std::tuple<uint64_t, uint64_t, uint64_t>;
 
----------------
Might be at the point where this should/could be a struct with named members?


================
Comment at: llvm/lib/Transforms/Utils/CodeLayout.cpp:1037
     for (size_t I = 0; I < EdgeCounts.size(); I++) {
-      auto It = EdgeCounts[I];
-      uint64_t Pred = It.first.first;
-      uint64_t Succ = It.first.second;
+      auto [Pred, Succ, ExecutionCount] = EdgeCounts[I];
       // Ignore recursive calls.
----------------
Then this (& elsewhere) wouldn't need a structured binding - it could access the members by name directly?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159526/new/

https://reviews.llvm.org/D159526



More information about the llvm-commits mailing list