On 06/15/2016 01:46 PM, Jakub Jelinek wrote:
Hi!

As the following testcase shows, CSE mishandles const/pure calls, it assumes
that const/pure calls can't clobber even their argument slots.  But, the
argument slots are owned by the callee, so need to be volatile across the
calls.  On the testcase the second round of argument stores is eliminated,
because CSE thinks those memory slots already have the right values.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2016-06-15  Jakub Jelinek  <ja...@redhat.com>

        PR rtl-optimization/71532
        * cse.c (cse_insn): For const/pure calls, invalidate argument passing
        memory slots.

        * gcc.dg/torture/pr71532.c: New test.
FWIW I don't think ownership of the argument slots has ever been definitively addressed by any ABI and it's been an open question in my mind for 20+ years -- though I've largely leaned towards callee ownership on my own thinking. In an ideal world we'd push to get this clarified at the ABI level.

Certainly this is the safe thing to do.

OK for the trunk.


Jeff

Reply via email to