[PATCH] D86973: [IRSim] Adding wrapper pass for IRSimilarityIdentfier

Jon Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 13:48:52 PDT 2020


jroelofs added inline comments.


================
Comment at: llvm/lib/Analysis/IRSimilarityIdentifier.cpp:685
+  Optional<SimilarityGroupList> &SimilarityCandidatesOpt = IRSI.getSimilarity();
+  assert(SimilarityCandidatesOpt.hasValue() && "SimilarityCandidates is None!");
+  SimilarityGroupList &SimilarityCandidates =
----------------
The accessors for Optional do this check for you, so you can just "dereference" it with `*` or `->` as needed without worrying about adding your own assertion on it.

If it's expected that IRSI will always have this populated once it has been constructed, then maybe getSimilarity() ought to be the one to unwrap the Optional.


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

https://reviews.llvm.org/D86973



More information about the llvm-commits mailing list