https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118551
Bug ID: 118551 Summary: Autofdo regressed 538.imagick_r by ~10% with -march=x86-64-v3 -O2 Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: liuhongt at gcc dot gnu.org Target Milestone: --- Similar like PR116743, it's related to ipa scaling, but in different place(estimate_bb_frequencies). /* If we have profile feedback in which this function was never executed, then preserve this info. */ if (!(bb->count == profile_count::zero ())) bb->count = count.guessed_local ().combine_with_ipa_count (ipa_count); ipa_count is the count of the entry block and it's zero, but the whole function is hot. estimate_bb_frequencies scale every non-zero bb count to zero since ipa_count is zero, and GCC optimized those BB for size since it thought the bb is cold. part to gcov_dump from the hot function: MeanShiftImage total:17008941 head:0 2: 0 25: 0 26: 0 29: 0 30: 0 31: 0 32: 0 32.1: 0 34: 0 35: 0 39: 0 40: 0 41: 0 42: 0 47.1: 0 47.2: 0 61: 0 63: 0 64: 1 66: 1 71: 1 GetCacheViewVirtualIndexQueue:1 72.1: 2189 72.2: 2189 85: 2197 GetMagickPixelPacket:2268 87: 2171 88: 2171 89.1: 2171 105: 3788 106: 3788 107: 3811 GetMagickPixelPacket:3931 109: 3788 110: 3788 111: 0 111.1: 72754 111.2: 72754 116: 72731 116.1: 816545 116.2: 816545 118: 1381111 123: 967682 GetOneCacheViewVirtualPixel:998671