[PATCH] D137905: [GlobalISel] Add new G_INVOKE_REGION_START/END instructions to fix an EH bug

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 15:13:45 PST 2022


aemerson added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineBasicBlock.cpp:258
+MachineBasicBlock::iterator MachineBasicBlock::getFirstTerminatorForward() {
+  iterator I = begin(), E = end();
+  while (I != E && !I->isTerminator())
----------------
arsenm wrote:
> aemerson wrote:
> > paquette wrote:
> > > paquette wrote:
> > > > `find_if`?
> > > Should we check for debug instructions + skip them here like in `getFirstTerminator()`, or is that not necessary?
> > I don't think it's necessary since debug instructions would never be terminators.
> getFirstTerminator does check for them, so I'm not sure what the rule is for debug instructions 
It's because `getFirstTerminator()` stops searching at the first non-debug-non-terminator instruction, walking up the block. That's how it determines whether something is the "first" terminator.

Unfortunately I can't really change that because it would make every call to it more expensive.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137905



More information about the llvm-commits mailing list