Index: llvm/include/llvm/Support/GenericDomTree.h =================================================================== --- llvm/include/llvm/Support/GenericDomTree.h +++ llvm/include/llvm/Support/GenericDomTree.h @@ -349,6 +349,9 @@ /// may (but is not required to) be null for a forward (backwards) /// statically unreachable block. DomTreeNodeBase *getNode(const NodeT *BB) const { + assert((!BB || !BB->getParent() || BB->getParent() == Parent) && + "A node from another function!"); + auto I = DomTreeNodes.find(BB); if (I != DomTreeNodes.end()) return I->second.get(); Index: llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-invariant-select-bug.ll =================================================================== --- llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-invariant-select-bug.ll +++ llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-invariant-select-bug.ll @@ -1,4 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; REQUIRES: asserts +; XFAIL: * ; RUN: opt -passes='simple-loop-unswitch' -S < %s | FileCheck %s ; FIXME: We should not replace `true` with `false` here!