[PATCH] D139872: [llvm][CallBrPrepare] split critical edges
Bill Wendling via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 18 16:08:33 PST 2023
void added inline comments.
================
Comment at: llvm/lib/CodeGen/CallBrPrepare.cpp:96
+ // at index 1 to avoid the default destination.
+ for (unsigned i = 1, e = CBR->getNumSuccessors(); i != e; ++i) {
+ // The same destination may appear multiple times in a callbr
----------------
nickdesaulniers wrote:
> void wrote:
> > You can iterate over the indirect destinations. Something like:
> >
> > ```
> > for (BasicBlock *BB : CBR->getIndirectDests()) {
> > }
> > ```
> I would have preferred to use range-for iteration here. IIRC, the issue with that approach was that `isCriticalEdge` takes an `unsigned` as the successor number (rather than the `BasicBlock` successor itself. If it did, that would probably have improved the ergonomics here. Let me know if you think I should add an overload of `isCriticalEdge` perhaps, or if I missed something else?
`isCriticalEdge` can also take a BB:
```
llvm/include/llvm/Analysis/CFG.h:
bool isCriticalEdge(const Instruction *TI, const BasicBlock *Succ,
bool AllowIdenticalEdges = false);
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139872/new/
https://reviews.llvm.org/D139872
More information about the llvm-commits
mailing list