This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix Eh delivery in partitioned functions
On Wed, 19 Jul 2017, Jan Hubicka wrote:
> > On Wed, 19 Jul 2017, Jan Hubicka wrote:
> >
> > > > > I think we could just output from generic code - I think it can be done by
> > > > > final_scan_insn. I don't know however if we have a way to tell if the section
> > > > > starts with a landing pad?
> > > >
> > > > Not sure either -- some insn note / bb note? Some flag on the label?
> > > > At least the latter should be easy to add if it's not there already.
> > > >
> > > > Richard.
> > >
> > > Hi,
> > > this is updated patch. I am now adding NOP_EXPR into the instruction stream.
> > > This is done before shorten branches so alignment tracking works there as
> > > expected.
> > > Landing pads are having PRESERVE flag set, but that is also true about named
> > > labels etc. So I think only safe way is to look them up from the EH tables
> > > which is not that hard. first_in_partition is now called on every landing
> > > pad in the cold section and it walks backward looking if it can be first. I added
> > > visited set to be sure it runs in linear time.
> > >
> > > Boostrapped/regtested x86_64-linux, OK?
> >
> > It looks sensible. You leak the hash_set and I wonder if you can hook
>
> Hmm, isn't the hash_set supposed to destruct itself at the end of scope?
Hmm, you are probably right ;)
> > it in pass_convert_to_eh_region_ranges instead which runs before
> > rest_of_handle_shorten_branches which means things can be entirely
> > contained in except.c?
>
> Yep, that is a good idea. I did not look into pass.def, just searched
> for convenient place to do it before branch relaxation (it probably ought
> to run after mdep reorg because no one knows what those will do with the
> nop :)
>
> Will re-test updated patch and commit. Thanks a lot!
Did you see the inline comments?
Thanks,
Richard.