[PATCH] D129660: [IR] Add Instruction::getAfterDefInsertionPoint()

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 10:54:40 PDT 2022


reames added inline comments.


================
Comment at: llvm/lib/IR/Instruction.cpp:135
+  }
+  if (InsertPt == InsertBB->end())
+    return nullptr;
----------------
Please add a comment explaining this case.  It's non obvious, and without your wording about catchswitch in the commit message, I'd not have figured this out.

Structure wise, I think I'd prefer:
if (phi node) {
} else if (terminator) {
  if (invoke) {}
  else if (callbr) {}
  else { assert(catchswitch) }
} else {
}

Not a strong preference, so please treat that as a suggestion, nothing more.  


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

https://reviews.llvm.org/D129660



More information about the llvm-commits mailing list