@@ -720,23 +720,6 @@ bool DataAggregator::doBranch(uint64_t From, uint64_t To, uint64_t Count,
720720 : isReturn (Func.disassembleInstructionAtOffset (Offset));
721721 };
722722
723- // Returns whether \p Offset in \p Func may be a call continuation excluding
724- // entry points and landing pads.
725- auto checkCallCont = [&](const BinaryFunction &Func, const uint64_t Offset) {
726- // No call continuation at a function start.
727- if (!Offset)
728- return false ;
729-
730- // FIXME: support BAT case where the function might be in empty state
731- // (split fragments declared non-simple).
732- if (!Func.hasCFG ())
733- return false ;
734-
735- // The offset should not be an entry point or a landing pad.
736- const BinaryBasicBlock *ContBB = Func.getBasicBlockAtOffset (Offset);
737- return ContBB && !ContBB->isEntryPoint () && !ContBB->isLandingPad ();
738- };
739-
740723 // Mutates \p Addr to an offset into the containing function, performing BAT
741724 // offset translation and parent lookup.
742725 //
@@ -749,8 +732,7 @@ bool DataAggregator::doBranch(uint64_t From, uint64_t To, uint64_t Count,
749732
750733 Addr -= Func->getAddress ();
751734
752- bool IsRetOrCallCont =
753- IsFrom ? checkReturn (*Func, Addr) : checkCallCont (*Func, Addr);
735+ bool IsRet = IsFrom && checkReturn (*Func, Addr);
754736
755737 if (BAT)
756738 Addr = BAT->translate (Func->getAddress (), Addr, IsFrom);
@@ -761,24 +743,16 @@ bool DataAggregator::doBranch(uint64_t From, uint64_t To, uint64_t Count,
761743 NumColdSamples += Count;
762744
763745 if (!ParentFunc)
764- return std::pair{Func, IsRetOrCallCont };
746+ return std::pair{Func, IsRet };
765747
766- return std::pair{ParentFunc, IsRetOrCallCont };
748+ return std::pair{ParentFunc, IsRet };
767749 };
768750
769- uint64_t ToOrig = To;
770751 auto [FromFunc, IsReturn] = handleAddress (From, /* IsFrom*/ true );
771- auto [ToFunc, IsCallCont ] = handleAddress (To, /* IsFrom*/ false );
752+ auto [ToFunc, _ ] = handleAddress (To, /* IsFrom*/ false );
772753 if (!FromFunc && !ToFunc)
773754 return false ;
774755
775- // Record call to continuation trace.
776- if (NeedsConvertRetProfileToCallCont && FromFunc != ToFunc &&
777- (IsReturn || IsCallCont)) {
778- LBREntry First{ToOrig - 1 , ToOrig - 1 , false };
779- LBREntry Second{ToOrig, ToOrig, false };
780- return doTrace (First, Second, Count);
781- }
782756 // Ignore returns.
783757 if (IsReturn)
784758 return true ;
@@ -1235,21 +1209,14 @@ std::error_code DataAggregator::parseAggregatedLBREntry() {
12351209 ErrorOr<StringRef> TypeOrErr = parseString (FieldSeparator);
12361210 if (std::error_code EC = TypeOrErr.getError ())
12371211 return EC;
1238- // Pre-aggregated profile with branches and fallthroughs needs to convert
1239- // return profile into call to continuation fall-through.
1240- auto Type = AggregatedLBREntry::BRANCH;
1241- if (TypeOrErr.get () == " B" ) {
1242- NeedsConvertRetProfileToCallCont = true ;
1212+ auto Type = AggregatedLBREntry::TRACE;
1213+ if (LLVM_LIKELY (TypeOrErr.get () == " T" )) {
1214+ } else if (TypeOrErr.get () == " B" ) {
12431215 Type = AggregatedLBREntry::BRANCH;
12441216 } else if (TypeOrErr.get () == " F" ) {
1245- NeedsConvertRetProfileToCallCont = true ;
12461217 Type = AggregatedLBREntry::FT;
12471218 } else if (TypeOrErr.get () == " f" ) {
1248- NeedsConvertRetProfileToCallCont = true ;
12491219 Type = AggregatedLBREntry::FT_EXTERNAL_ORIGIN;
1250- } else if (TypeOrErr.get () == " T" ) {
1251- // Trace is expanded into B and [Ff]
1252- Type = AggregatedLBREntry::TRACE;
12531220 } else {
12541221 reportError (" expected T, B, F or f" );
12551222 return make_error_code (llvm::errc::io_error);
0 commit comments