This is the mail archive of the 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: Fix PHI handling in ipa-split

On Sat, Jan 1, 2011 at 9:10 AM, H.J. Lu <> wrote:
> On Fri, Jun 25, 2010 at 9:57 AM, Jan Hubicka <> wrote:
>> Hi,
>> fixing the PHIs it turned out I got PHI handling completely wrong in visit_bb.
>> Using FOR_EACH_SSA_TREE_OPERAND on PHI is bad idea (that code got copied from
>> normal statement handling).
>> So this patch fixes this problem and allows splitting blocks with PHI in entry_bb
>> when either PHI is virtual, or all incomming edges from header have same values
>> (this is to allow split blocks starting with a loop).
>> tree-inline needs updating to handle PHIs in entry_bb. ?This is quite easy,
>> the edge needs to be created first and then regular PHI copying code sees
>> an edge that has no direct equivalent in original function body. ?Instead
>> it needs to look for edge from basic block that was not copied.
>> Alternative would be to split BB in ipa-split and avoid PHIs in entry BB,
>> but I think it is easier this way also for future other users of partial
>> clonning (that would be, for example, autopar)
>> Finally to make splitting effective on regions starting by loop, one needs
>> to be cureful about entry frequency. ?It is not entry_bb frequency, but rather
>> sum of frequencies of edges incomming to entry_bb from the header.
>> Doing similar analysis on reasons for not splitting we now get:
>> ? ?110 ?split part has non-ssa uses
>> ? ?833 ?need to pass non-param values
>> ? ?982 ?entry BB has PHI with multiple variants
>> ? 5042 ?split size is smaller than call overhead
>> ? 6813 ?incomming frequency is too large.
>> ?25300 ?header size is too large for inline candidate
>> There are about 800 splits, so teaching the code to pass non-param values still
>> has potential to triple count of splits, but we definitly got a lot better:
>> most of time we invalidate split because we do now want to split there.
>> Bootstrapped/regtested x86_64-linux, OK?
>> Honza
>> ? ? ? ?* gcc.dg/tree-ssa/ipa-split-2.c: New testcase.
>> ? ? ? ?* ipa-split.c (consider_split): PHI in entry block is OK as long as all
>> ? ? ? ?edges comming from header are equivalent.
>> ? ? ? ?(visit_bb): Handle PHIs correctly.
>> ? ? ? ?* tree-inline.c (copy_phis_for_bb): Be able to copy
>> ? ? ? ?PHI from entry edge.
>> ? ? ? ?(copy_cfg_body): Produce edge from entry BB before copying
>> ? ? ? ?PHIs.
> This caused:

This also caused:


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