diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp --- a/bolt/lib/Core/BinaryFunction.cpp +++ b/bolt/lib/Core/BinaryFunction.cpp @@ -1842,6 +1842,16 @@ if (HasInternalLabelReference) return false; + // If there are references to function internals from data but the function + // does not have recognized jump tables, mark it as having unknown control + // flow and register externally referenced blocks as entry points. + if (hasInternalReference() && JumpTables.empty()) { + HasUnknownControlFlow = true; + for (uint64_t PossibleDestination : ExternallyReferencedOffsets) + if (BinaryBasicBlock *BB = getBasicBlockAtOffset(PossibleDestination)) + addEntryPoint(*BB); + } + // If there's only one jump table, and one indirect jump, and no other // references, then we should be able to derive the jump table even if we // fail to match the pattern.