This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Propagate profile counts after switch case expansion (issue5896043)


On Fri, Mar 23, 2012 at 3:29 PM, Andi Kleen <andi@firstfloor.org> wrote:
> Easwaran Raman <eraman@google.com> writes:
>
>> Some more background on this patch: Right now, while the execution
>> counts of different case labels of a switch statement are obtained
>> during profile collection, they are not propagated to RTL. Instead,
>> counts are regenerated at the RTL level using static heuristics that
>> tend to weigh branches equally which can cause poor optimization of
>> hot code. This patch ensures that the counts collected during profile
>> collection are correctly propagated allowing hot code to be better
>> optimized by RTL optimizations. ?Patch tested on x86_64.
>
> I think your patch doesn't use the probably to weight the decision
> tree for non tablejump, right? I looked at this some time ago,
> but the patch always had problems.

Do you mean use the weights to decide the shape of the binary tree
(similar to COST_TABLE heuristic)? I am planning to send a separate
patch for that. This one just makes sure that the profile counts are
propagated correctly. So you will still have a situation where a
branch corresponding to an infrequently executed case dominates a
frequently executed case, but the BB of the cases gets the right
profile weight.

- Easwaran

> -Andi
>
> --
> ak@linux.intel.com -- Speaking for myself only


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]