[PATCH] D38427: Graph builder implementation.

Vlad Tsyrklevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 14:06:42 PDT 2017


vlad.tsyrklevich added inline comments.


================
Comment at: tools/llvm-cfi-verify/GraphBuilder.h:75
+  std::vector<ConditionalBranchNode> BranchNodes;
+  std::vector<ControlFlowNode *> OrphanedNodes;
+};
----------------
Could we represent this as (1) a uint64_t SrcAddr -> uint64_t DstAddr mapping and (2) a std::vector<uint64_t> of orphaned nodes? Then you would not need the Next pointers, and presumably FlowLength can simply be maintained as an argument to buildFlowGraphImpl(). You could maintain O(1) lookup by using `llvm::DenseMap` which is hash-table based and lighter-weight than `std::map` (see http://llvm.org/docs/ProgrammersManual.html#llvm-adt-densemap-h) and that seems cleaner to me than the current structure, WDYT?


https://reviews.llvm.org/D38427





More information about the llvm-commits mailing list