This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][RTL-ifcvt] PR rtl-optimization/67465: Do not ifcvt complex blocks if the else block is empty
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jeff Law <law at redhat dot com>, Rainer Orth <ro at cebitec dot uni-bielefeld dot de>
- Date: Mon, 7 Sep 2015 12:14:15 -0700
- Subject: Re: [PATCH][RTL-ifcvt] PR rtl-optimization/67465: Do not ifcvt complex blocks if the else block is empty
- Authentication-results: sourceware.org; auth=none
- References: <55EDBB73 dot 5080900 at arm dot com>
On Mon, Sep 7, 2015 at 9:29 AM, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
> Hi all,
>
> This patch fixes the PRs in the ChangeLog that have been reported against my
> if-conversion patch.
> The problem occurs when the 'then' block is complex but the else block is
> empty.
> In this case the calling code in noce_process_if_block takes the 'else' move
> (x := b) from
> the test block. However, we have not checked whether the test block is valid
> for complex-block
> if-conversion with bb_valid_for_noce_process_p. Also, that's a case I wasn't
> particularly targeting
> when writing the initial patch.
>
> This patch bails out of noce_try_cmove_arith when one of the blocks is
> complex and the other is empty.
> I've checked that if-conversion still happens in the cases of interest from
> the original patch.
>
> I've added the testcase from PR 67465 since that one uses __builtin_abort
> and triggers the problem nicely.
> The others show the miscompilation using printf seems to go away if I
> replace it with an abort.
> I have confirmed manually that the miscompilation goes away on those
> testcases.
>
> PR rtl-optimization/67481 is a testsuite regression on sparc-solaris that
> Rainer reported. I haven't tested
> that this patch fixes that, but I suspect that the root cause is the same.
> Rainer, could you please
> check that this fixes the regression for you?
>
> Bootstrapped and tested on aarch64 and x86_64.
>
> Ok for trunk if sparc testing comes ok?
>
> Thanks,
> Kyrill
>
> 2015-09-07 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>
> PR rtl-optimization/67456
> PR rtl-optimization/67464
> PR rtl-optimization/67465
> PR rtl-optimization/67481
> * ifcvt.c (noce_try_cmove_arith): Bail out if one of the blocks
> is complex and the other is empty.
>
> 2015-09-07 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>
> * gcc.dg/pr67465.c: New test.
Does it fix
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67462
--
H.J.