@@ -720,23 +720,6 @@ bool DataAggregator::doBranch(uint64_t From, uint64_t To, uint64_t Count,
720
720
: isReturn (Func.disassembleInstructionAtOffset (Offset));
721
721
};
722
722
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
-
740
723
// Mutates \p Addr to an offset into the containing function, performing BAT
741
724
// offset translation and parent lookup.
742
725
//
@@ -749,8 +732,7 @@ bool DataAggregator::doBranch(uint64_t From, uint64_t To, uint64_t Count,
749
732
750
733
Addr -= Func->getAddress ();
751
734
752
- bool IsRetOrCallCont =
753
- IsFrom ? checkReturn (*Func, Addr) : checkCallCont (*Func, Addr);
735
+ bool IsRet = IsFrom && checkReturn (*Func, Addr);
754
736
755
737
if (BAT)
756
738
Addr = BAT->translate (Func->getAddress (), Addr, IsFrom);
@@ -761,24 +743,16 @@ bool DataAggregator::doBranch(uint64_t From, uint64_t To, uint64_t Count,
761
743
NumColdSamples += Count;
762
744
763
745
if (!ParentFunc)
764
- return std::pair{Func, IsRetOrCallCont };
746
+ return std::pair{Func, IsRet };
765
747
766
- return std::pair{ParentFunc, IsRetOrCallCont };
748
+ return std::pair{ParentFunc, IsRet };
767
749
};
768
750
769
- uint64_t ToOrig = To;
770
751
auto [FromFunc, IsReturn] = handleAddress (From, /* IsFrom*/ true );
771
- auto [ToFunc, IsCallCont ] = handleAddress (To, /* IsFrom*/ false );
752
+ auto [ToFunc, _ ] = handleAddress (To, /* IsFrom*/ false );
772
753
if (!FromFunc && !ToFunc)
773
754
return false ;
774
755
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
- }
782
756
// Ignore returns.
783
757
if (IsReturn)
784
758
return true ;
@@ -1235,21 +1209,14 @@ std::error_code DataAggregator::parseAggregatedLBREntry() {
1235
1209
ErrorOr<StringRef> TypeOrErr = parseString (FieldSeparator);
1236
1210
if (std::error_code EC = TypeOrErr.getError ())
1237
1211
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" ) {
1243
1215
Type = AggregatedLBREntry::BRANCH;
1244
1216
} else if (TypeOrErr.get () == " F" ) {
1245
- NeedsConvertRetProfileToCallCont = true ;
1246
1217
Type = AggregatedLBREntry::FT;
1247
1218
} else if (TypeOrErr.get () == " f" ) {
1248
- NeedsConvertRetProfileToCallCont = true ;
1249
1219
Type = AggregatedLBREntry::FT_EXTERNAL_ORIGIN;
1250
- } else if (TypeOrErr.get () == " T" ) {
1251
- // Trace is expanded into B and [Ff]
1252
- Type = AggregatedLBREntry::TRACE;
1253
1220
} else {
1254
1221
reportError (" expected T, B, F or f" );
1255
1222
return make_error_code (llvm::errc::io_error);
0 commit comments