From 72de3244b03c56b9ede719f13bd8b6fcac65a1c0 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 26 Feb 2025 12:49:08 -0800 Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?= =?UTF-8?q?l=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using spr 1.3.4 --- bolt/lib/Core/BinaryFunction.cpp | 5 ++--- bolt/lib/Profile/DataAggregator.cpp | 2 +- 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 ff5eb5cf6e1eb..161733d75a2ab 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 d20626bd5062f..dc0f91030bc18 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 70a9f084f009b..ae3e0b9ddce38 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(