On Mon, Sep 7, 2015 at 9:29 AM, Kyrill Tkachov <kyrylo.tkac...@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.tkac...@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.tkac...@arm.com> > > * gcc.dg/pr67465.c: New test.
Does it fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67462 -- H.J.