diff options
| author | Amir Ayupov <aaupov@fb.com> | 2025-02-26 12:49:08 -0800 |
|---|---|---|
| committer | Amir Ayupov <aaupov@fb.com> | 2025-02-26 12:49:08 -0800 |
| commit | 72de3244b03c56b9ede719f13bd8b6fcac65a1c0 (patch) | |
| tree | d73e2ffefdccd9950e7e71cb54e5e4563dcd93a7 | |
| parent | f5675243995dbca22319ed4c0665b3e46138285b (diff) | |
[𝘀𝗽𝗿] initial versionusers/aaupov/spr/bolt-build-cfg-for-non-simple-functions-in-aggregation-mode
Created using spr 1.3.4
| -rw-r--r-- | bolt/lib/Core/BinaryFunction.cpp | 5 | ||||
| -rw-r--r-- | bolt/lib/Profile/DataAggregator.cpp | 2 | ||||
| -rw-r--r-- | bolt/lib/Rewrite/RewriteInstance.cpp | 3 |
3 files changed, 5 insertions, 5 deletions
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp index ff5eb5cf6e1e..161733d75a2a 100644 --- a/bolt/lib/Core/BinaryFunction.cpp +++ b/bolt/lib/Core/BinaryFunction.cpp @@ -1754,8 +1754,7 @@ void BinaryFunction::postProcessEntryPoints() { // In non-relocation mode there's potentially an external undetectable // reference to the entry point and hence we cannot move this entry // point. Optimizing without moving could be difficult. - // In aggregation, register any known entry points for CFG construction. - if (!BC.HasRelocations && !opts::AggregateOnly) + if (!BC.HasRelocations) setSimple(false); const uint32_t Offset = KV.first; @@ -2084,7 +2083,7 @@ void BinaryFunction::recomputeLandingPads() { Error BinaryFunction::buildCFG(MCPlusBuilder::AllocatorIdTy AllocatorId) { auto &MIB = BC.MIB; - if (!isSimple()) { + if (!isSimple() && !opts::AggregateOnly) { assert(!BC.HasRelocations && "cannot process file with non-simple function in relocs mode"); return createNonFatalBOLTError(""); diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp index d20626bd5062..dc0f91030bc1 100644 --- a/bolt/lib/Profile/DataAggregator.cpp +++ b/bolt/lib/Profile/DataAggregator.cpp @@ -871,7 +871,7 @@ DataAggregator::getFallthroughsInTrace(BinaryFunction &BF, BinaryContext &BC = BF.getBinaryContext(); - if (!BF.isSimple()) + if (BF.empty()) return std::nullopt; assert(BF.hasCFG() && "can only record traces in CFG state"); diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp index 70a9f084f009..ae3e0b9ddce3 100644 --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -3438,7 +3438,8 @@ void RewriteInstance::buildFunctionsCFG() { }; ParallelUtilities::PredicateTy SkipPredicate = [&](const BinaryFunction &BF) { - return !shouldDisassemble(BF) || !BF.isSimple(); + // Construct CFG for non-simple functions in aggregation mode. + return !(shouldDisassemble(BF) && (BF.isSimple() || opts::AggregateOnly)); }; ParallelUtilities::runOnEachFunctionWithUniqueAllocId( |
