@@ -831,6 +831,7 @@ struct BBAddrMap {
831831 bool BrProb : 1 ;
832832 bool MultiBBRange : 1 ;
833833 bool OmitBBEntries : 1 ;
834+ bool CallsiteOffsets : 1 ;
834835
835836 bool hasPGOAnalysis () const { return FuncEntryCount || BBFreq || BrProb; }
836837
@@ -842,7 +843,8 @@ struct BBAddrMap {
842843 (static_cast <uint8_t >(BBFreq) << 1 ) |
843844 (static_cast <uint8_t >(BrProb) << 2 ) |
844845 (static_cast <uint8_t >(MultiBBRange) << 3 ) |
845- (static_cast <uint8_t >(OmitBBEntries) << 4 );
846+ (static_cast <uint8_t >(OmitBBEntries) << 4 ) |
847+ (static_cast <uint8_t >(CallsiteOffsets) << 5 );
846848 }
847849
848850 // Decodes from minimum bit width representation and validates no
@@ -851,7 +853,7 @@ struct BBAddrMap {
851853 Features Feat{
852854 static_cast <bool >(Val & (1 << 0 )), static_cast <bool >(Val & (1 << 1 )),
853855 static_cast <bool >(Val & (1 << 2 )), static_cast <bool >(Val & (1 << 3 )),
854- static_cast <bool >(Val & (1 << 4 ))};
856+ static_cast <bool >(Val & (1 << 4 )), static_cast < bool >(Val & ( 1 << 5 )) };
855857 if (Feat.encode () != Val)
856858 return createStringError (
857859 std::error_code (), " invalid encoding for BBAddrMap::Features: 0x%x" ,
@@ -861,9 +863,10 @@ struct BBAddrMap {
861863
862864 bool operator ==(const Features &Other) const {
863865 return std::tie (FuncEntryCount, BBFreq, BrProb, MultiBBRange,
864- OmitBBEntries) ==
866+ OmitBBEntries, CallsiteOffsets ) ==
865867 std::tie (Other.FuncEntryCount , Other.BBFreq , Other.BrProb ,
866- Other.MultiBBRange , Other.OmitBBEntries );
868+ Other.MultiBBRange , Other.OmitBBEntries ,
869+ Other.CallsiteOffsets );
867870 }
868871 };
869872
@@ -914,13 +917,18 @@ struct BBAddrMap {
914917 uint32_t Size = 0 ; // Size of the basic block.
915918 Metadata MD = {false , false , false , false ,
916919 false }; // Metdata for this basic block.
920+ // Offsets of callsites (end of call instructions), relative to the basic
921+ // block start.
922+ SmallVector<uint32_t , 1 > CallsiteOffsets;
917923
918- BBEntry (uint32_t ID, uint32_t Offset, uint32_t Size, Metadata MD)
919- : ID(ID), Offset(Offset), Size(Size), MD(MD){};
924+ BBEntry (uint32_t ID, uint32_t Offset, uint32_t Size, Metadata MD,
925+ SmallVector<uint32_t , 1 > CallsiteOffsets)
926+ : ID(ID), Offset(Offset), Size(Size), MD(MD),
927+ CallsiteOffsets (std::move(CallsiteOffsets)) {}
920928
921929 bool operator ==(const BBEntry &Other) const {
922930 return ID == Other.ID && Offset == Other.Offset && Size == Other.Size &&
923- MD == Other.MD ;
931+ MD == Other.MD && CallsiteOffsets == Other. CallsiteOffsets ;
924932 }
925933
926934 bool hasReturn () const { return MD.HasReturn ; }
0 commit comments