This is the mail archive of the gcc-patches@gcc.gnu.org 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: [PATCH][RTL-ifcvt] PR rtl-optimization/67465: Do not ifcvt complex blocks if the else block is empty


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.


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