This assertion should help us catch cases when DT is used in a way that doesn't make much sense and usually indicates usage errors. In D110752 you can see a test on which this assertion catches a miscompile. When processing foo SimpleLoopUnswitch decided to make dominates(BB1, BB2) query with BB2 being a block from another function (bar). In that case the result of the query was true since B isn't reachable from foo's entry, so SimpleLoopUnswitch went ahead and replaced the use of true in bar because the preheader of one of the loops from foo "dominates" the entry block from bar.
I decided to add this assertion to getNode since all queries seem to be routed through that function for all non-trivial cases.
Is !BB really a valid input to this function?