[PATCH] D129660: [IR] Add Instruction::getAfterDefInsertionPoint()
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 14 00:26:37 PDT 2022
nikic added inline comments.
================
Comment at: llvm/lib/IR/Instruction.cpp:135
+ }
+ if (InsertPt == InsertBB->end())
+ return nullptr;
----------------
reames wrote:
> 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.
I've kept the general code structure, but added an assertion that no terminators fall through to the last cast, so we notice if additional value-returning terminators are introduced.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129660/new/
https://reviews.llvm.org/D129660
More information about the llvm-commits
mailing list