[PATCH] D110922: [LoopPeel] Peel loops with deoptimizing exits

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 01:37:11 PDT 2021


mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/BasicBlockUtils.cpp:494
 
+bool llvm::IsBlockDeoptimizing(const BasicBlock *BB) {
+  // Remember visited blocks to avoid infinite loop
----------------
This name is misleading. It's not always deoptimizing (if it ends with unreachable), and neither *this* block is deoptimizing. Maybe smth like `IsBlockFollowedByDeoptOrUnreached`?


================
Comment at: llvm/lib/Transforms/Utils/BasicBlockUtils.cpp:502
+        isa<UnreachableInst>(BB->getTerminator()))
+      return true;
+    BB = BB->getSingleSuccessor();
----------------
There is one thing that bugs me. Imagine a sutiation:
```
loop_exit:
  call foo() // will not return, but is not a deopt
  unreachable
```

I'm not sure if it's bad actually. But maybe we should consider checking all other (non deopt) instruction with `isGuaranteedToTransferExecutionToSuccessor`. Opinions?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110922



More information about the llvm-commits mailing list