PR39241 uncovered an interesting problem with importing global variables containing blockaddress. Such variables can be imported only with function(s) referenced by blockaddress statements. As this is hard to check, I suggest simpler fix which does the following:
- Marks all GVs which contain blockaddrss statement as "not eligible to import".
- Instead of checking for dummy module in computeImportForReferencedGlobals check "not eligible to import" flag. This shouldn't break things as everything in non-thinlto module is marked as not eligible to import.
Document return value. Also, there are callers of findRefEdges in computeFunctionSummary. Are those ever expected to reference a blockaddress? From what I can tell in https://llvm.org/docs/LangRef.html#addresses-of-basic-blocks, it seems they could be referenced by an indirectbr instruction. Either those callsites need to do something similar with the return value, or they should assert findRefEdges returns false.