On Fri, Sep 02, 2016 at 11:31:04AM +0000, Wilco Dijkstra wrote: > Ramana Radhakrishnan wrote: > > Can you please file a PR for this and add some testcases ? This sounds > > like a serious enough problem that needs to be looked at probably going > > back since the dawn of time. > > I've created PR77455. Updated patch below: > > This patch simplifies the handling of the EH return value. We force the use > of the > frame pointer so the return location is always at FP + 8. This means we can > emit > a simple volatile access in EH_RETURN_HANDLER_RTX without needing md > patterns, splitters and frame offset calculations. The new implementation > also > fixes various bugs in aarch64_final_eh_return_addr, which does not work with > -fomit-frame-pointer, alloca or outgoing arguments.
I've been putting off reviewing this patch for a while now, because I don't understand enough about the current eh_return code to understand why what you're proposing is correct. The best way to progress this patch would be to go in to more detail as to what the current code does, why we don't need it, and why your new implementation is sufficient. The current code looks like it covers special cases, and calls out DSE and CSELIB as needing special handling - your new code doesn't. Could you explain your patch to me assuming I know very little about the implementation, with particular focus on why we no longer need the special cases? Thanks, James > > Bootstrap OK, GCC Regression OK, OK for trunk? Would it be useful to backport > this to GCC6.x? > > ChangeLog: > > 2016-09-02 Wilco Dijkstra <wdijk...@arm.com> > > PR77455 > gcc/ > * config/aarch64/aarch64.md (eh_return): Remove pattern and splitter. > * config/aarch64/aarch64.h (AARCH64_EH_STACKADJ_REGNUM): Remove. > (EH_RETURN_HANDLER_RTX): New define. > * config/aarch64/aarch64.c (aarch64_frame_pointer_required): > Force frame pointer in EH return functions. > (aarch64_expand_epilogue): Add barrier for eh_return. > (aarch64_final_eh_return_addr): Remove. > (aarch64_eh_return_handler_rtx): New function. > * config/aarch64/aarch64-protos.h (aarch64_final_eh_return_addr): > Remove. > (aarch64_eh_return_handler_rtx): New prototype. > > testsuite/ > * gcc.target/aarch64/eh_return.c: New test. > --