[PATCH] D96346: [NFC][PPC] Refactor TOC representation to allow several entries for the same symbol

Baptiste Saleil via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 10 15:16:17 PST 2021


bsaleil added inline comments.


================
Comment at: llvm/include/llvm/MC/MCExpr.h:421
+// Specialize DenseMapInfo to allow MCSymbolRefExpr::VariantKind in DenseMap
+template <> struct DenseMapInfo<MCSymbolRefExpr::VariantKind> {
+  static inline MCSymbolRefExpr::VariantKind getEmptyKey() {
----------------
sfertile wrote:
> I'm not sure why we need this, or even why this works ... IIUC MapVector creates a dense map from the key type to the index of the value. Shouldn't we be creating a `DenseMapInfo` of the key type which is now a `std::pair<const MCSymbol *, MCSymbolRefExpr::VariantKind>`?
There is a generic implementation of `DenseMapInfo<std::pair<T, U>>` in `DenseMapInfo.h` which relies on `DenseMapInfo<T>` and `DenseMapInfo<U>`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96346



More information about the llvm-commits mailing list