[PATCH] D86589: (Expensive) Check for Loop, SCC and Region pass return status

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 3 08:32:42 PDT 2020


jdoerfert added inline comments.


================
Comment at: llvm/lib/IR/StructuralHash.cpp:51
+
+      const Instruction *Term = BB->getTerminator();
+      for (unsigned i = 0, e = Term->getNumSuccessors(); i != e; ++i) {
----------------
fhahn wrote:
> uabelho wrote:
> > Hi!
> > What if the BB doesn't have a terminator at all? Then Term will be nullptr which I don't think is good..
> > 
> > (This happens for us in the unit test PassManager.CallGraphUpdater0 with expensive checks when we run in our downstream clone)
> I'd assume this should only be called for valid IR, which means there must be terminator? 
> 
> Unrelated, but could this just be something like `for (auto &Succ : successors(BB)) {`?
> I'd assume this should only be called for valid IR, which means there must be terminator?

Yes. We cannot harden this for broken IR (without good reason). @uabelho What pass breaks the IR?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86589



More information about the llvm-commits mailing list