[PATCH] D139872: [llvm][CallBrPrepare] split critical edges

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 18 15:54:21 PST 2023


nickdesaulniers 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
----------------
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?


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