[PATCH] D45150: Less conservative LoopSafetyInfo for headers

Piotr Padlewski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 8 04:56:30 PDT 2018


Prazek added inline comments.


================
Comment at: llvm/include/llvm/Analysis/MustExecute.h:43
+  bool HeaderMayThrow = false;
+  const Instruction* FirstThrowingHeaderInstruction = nullptr;
+
----------------
amharc wrote:
> This still tracks neither deletions nor RAUWs.
I wanted to change it o AssertingVH, but as it turned out it is sometimes legal to remove the call that could throw, which would invalidate the cache. Went with your idea.


================
Comment at: llvm/lib/Analysis/MustExecute.cpp:283
+  for (const auto &HeaderInstr : *CurLoop->getHeader()) {
+    if (&HeaderInstr == FirstThrowingHeaderInstruction)
+      return false;
----------------
amharc wrote:
> Wouldn't checking `isGuaranteedToTransferExecutionToSuccessor(&HeaderInstr)` be somewhat less error-prone wrt. deletions, RAUWs etc., especially since the header is already being scanned from the beginning?
seems good, lowered the step count


Repository:
  rL LLVM

https://reviews.llvm.org/D45150





More information about the llvm-commits mailing list