@@ -83,7 +83,10 @@ bool StaticDataSplitter::splitJumpTablesWithProfiles(
8383 MachineFunction &MF, MachineJumpTableInfo &MJTI) {
8484 int NumChangedJumpTables = 0 ;
8585 // Regard a jump table as hot by default. If the source and all of destination
86- // blocks are cold, regard the jump table as cold.
86+ // blocks are cold, regard the jump table as cold. While a destination block
87+ // does not read a jump table (unless it's also a source block), a hot
88+ // destination heuristically makes its jump table hot to accommodate for
89+ // potential profile data skews (from sampled profiles, for example).
8790 DataHotness Hotness = DataHotness::Hot;
8891 for (const auto &MBB : MF) {
8992 // IMPORTANT, `getJumpTableIndex` is a thin wrapper around per-target
@@ -121,11 +124,9 @@ bool StaticDataSplitter::splitJumpTables(MachineFunction &MF) {
121124 if (!MJTI || MJTI->getJumpTables ().empty ())
122125 return false ;
123126
124- // Place jump tables according to block hotness if block counters are
125- // available. Check function entry count because BFI depends on it to derive
126- // block counters.
127+ // Place jump tables according to block hotness if function has profile data.
127128 if (PSI && PSI->hasProfileSummary () && MBFI &&
128- MF.getFunction ().getEntryCount ())
129+ MF.getFunction ().hasProfileData ())
129130 return splitJumpTablesWithProfiles (MF, *MJTI);
130131
131132 // Conservatively place all jump tables in the hot-suffixed section if profile
0 commit comments