[PATCH] D140166: [IR] return nullptr in Instruction::getInsertionPointAfterDef for CallBrInst

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 12:55:34 PST 2023


nickdesaulniers marked an inline comment as done.
nickdesaulniers added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:3381-3383
+  // CallBr's don't have a single point after a def to insert at.
+  if (isa<CallBrInst>(Call))
+    return false;
----------------
nikic wrote:
> StephenTozer wrote:
> > This might be more aggressive than necessary, since if the return type doesn't change or the call instruction has no use, a PHI does not need to be inserted; this could be moderated by moving this to the block at line 3409 (`if (OldRetTy != NewRetTy)`), and checking whether the return value has any uses. With that said, this is a minor point since as you said this won't even be touched at this point, so doesn't need to block merging imo.
> This entire transform is not relevant for callbr, it only works on calls to functions, not calls to inline asm. You could replace this with `assert(!isa<CallBrInst>(Call))`.
adding the assert causes Transforms/InstCombine/freeze.ll to fail, hitting that assertion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140166



More information about the llvm-commits mailing list