[PATCH] D87315: [IRSim] Letting gep instructions be legal for similarity identification.

Jon Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 17:21:43 PDT 2020


jroelofs accepted this revision.
jroelofs added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Analysis/IRSimilarityIdentifier.cpp:47
+  // are the same in the two instructions
+  if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(A.Inst)) {
+    GetElementPtrInst *OtherGEP = cast<GetElementPtrInst>(B.Inst);
----------------
`auto *GEP` is probably appropriate here, if you want, since the type name gets repeated.


================
Comment at: llvm/lib/Analysis/IRSimilarityIdentifier.cpp:57
+                  iterator_range<Use *>>
+        ZippedOperands = zip(GEP->indices(), OtherGEP->indices());
+
----------------
Likewise, I'd probably `auto` these, since the type of the iterator isn't super important to make visible. I think this is a grey area when it comes to community preference, so either way is fine, and I'll leave it up to you.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87315



More information about the llvm-commits mailing list