[PATCH] D34487: Restrict the definition of loop preheader to avoid special blocks

David Majnemer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 22 11:32:48 PDT 2017


majnemer added inline comments.


================
Comment at: lib/IR/BasicBlock.cpp:364-371
+  // It isn't safe to hoist instructions across Windows exception handling
+  // boundary blocks and it doesn't make sense to hoist instructions into
+  // blocks that can't have successors.
+  if (isa<CatchReturnInst>(Term) || isa<CleanupReturnInst>(Term) ||
+      isa<CatchSwitchInst>(Term) || isa<InvokeInst>(Term) ||
+      isa<ResumeInst>(Term) || isa<ReturnInst>(Term) ||
+      isa<UnreachableInst>(Term))
----------------
It should be impossible to get here if Term has no successors, no? Couldn't we `assert(Term->getNumSuccessors > 0)`?

Also, could we simplify this by just returning return `!Term->IsExceptional()` ?


Repository:
  rL LLVM

https://reviews.llvm.org/D34487





More information about the llvm-commits mailing list