[PATCH] D86968: [IRSim] Adding IR Instruction Mapper

Andrew Litteken via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 11:56:39 PDT 2020


AndrewLitteken added inline comments.


================
Comment at: llvm/include/llvm/Analysis/IRSimilarityIdentifier.h:173
+    using llvm::hash_value;
+    assert(E && "IRInstructionData is a nullptr?");
+    return hash_value(*E);
----------------
plotfi wrote:
> AndrewLitteken wrote:
> > plotfi wrote:
> > > Can you make these a pass by reference to avoid the need for assert? 
> > Since the DenseMap accepts an IRInstructionData pointer rather than a value, these have to be a pointer rather than pass by reference.
> Cant you just take the address of the reference when adding to the DenseMap?? 
I'm not sure what you're asking for.  These function are for the DenseMapInfo struct that makes sure that the pointers aren't just mapped by the address, but rather, by the instruction itself.  As I understand it, since the DenseMap is set to accept IRInstructionData pointers, the DenseMapInfo functions have to handle pointers, not values, and so can't be by reference. But, I might be missing something, I haven't had to work with a lot of these data structures before.


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

https://reviews.llvm.org/D86968



More information about the llvm-commits mailing list