[PATCH] D91767: [DomTree][NFC] Introduce function that finds common dom of multiple instructions

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 02:48:54 PST 2020


skatkov added inline comments.


================
Comment at: llvm/lib/IR/Dominators.cpp:348
+  Instruction *CommonDom = *It++;
+  for (auto E = Insns.end(); It != E; ++It) {
+    Instruction *Curr = *It;
----------------
What if you meet PHi node?


================
Comment at: llvm/lib/IR/Dominators.cpp:352
+    // Case 1: instructions from the same block. Pick the top one.
+    if (CurrBB == CommonDom->getParent()) {
+      if (Curr->comesBefore(CommonDom))
----------------
Introduce a variable for: CommonDom->getParent()
It appears three time in a loop.


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

https://reviews.llvm.org/D91767



More information about the llvm-commits mailing list