[PATCH] D30529: [RFC][GlobalISel] Enable legalizing non-power-of-2 sized types.

Kristof Beyls via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 08:47:50 PDT 2017


kristof.beyls marked an inline comment as done.
kristof.beyls added inline comments.


================
Comment at: include/llvm/CodeGen/GlobalISel/LegalizerInfo.h:342
+    const unsigned OpcodeIdx = Opcode - FirstOp;
+    if (NumElements2Actions[OpcodeIdx].find(ElementSize) ==
+        NumElements2Actions[OpcodeIdx].end())
----------------
aemerson wrote:
> Not to block this patch, but std::map seems a little heavy handed for use here, given I think its a BST underneath. I'm assuming DenseMap won't work because of you need to define another tombstone key. Maybe use unordered_map or a simple vector?
Thanks Amara - indeed, an ordered map is not needed.
I switched it to unordered_map.
A pre-allocated vector would waste too much space IMHO, and I don't think it's useful to add the complexity of resizing the vector at run-time until we've seen unordered_map actually is too slow in practice.
As you've guessed, I looked into using a DenseMap here before and concluded that it wouldn't work easily.


https://reviews.llvm.org/D30529





More information about the llvm-commits mailing list