Bug 63917 - [5 Regression] r217646 caused many failures
Summary: [5 Regression] r217646 caused many failures
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 5.0
: P1 normal
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
: 64007 (view as bug list)
Depends on:
Blocks: 64255
  Show dependency treegraph
 
Reported: 2014-11-17 16:12 UTC by H.J. Lu
Modified: 2015-04-07 13:24 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-11-17 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2014-11-17 16:12:12 UTC
On Linux/ia32, r217646 caused:

FAIL: gcc.dg/torture/fp-int-convert-float128.c   -O0  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128.c   -O1  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128.c   -O2  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128.c   -O3 -fomit-frame-pointer  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128.c   -O3 -g  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128.c   -Os  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c   -O0  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c   -O1  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c   -O2  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c   -O3 -fomit-frame-pointer  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c   -O3 -g  execution test
FAIL: gcc.dg/torture/fp-int-convert-float128-timode.c   -Os  execution test
FAIL: gfortran.dg/erf_3.F90   -O0  execution test
FAIL: gfortran.dg/erf_3.F90   -O1  execution test
FAIL: gfortran.dg/erf_3.F90   -O2  execution test
FAIL: gfortran.dg/erf_3.F90   -O3 -fomit-frame-pointer  execution test
FAIL: gfortran.dg/erf_3.F90   -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  execution test
FAIL: gfortran.dg/erf_3.F90   -O3 -fomit-frame-pointer -funroll-loops  execution test
FAIL: gfortran.dg/erf_3.F90   -O3 -g  execution test
FAIL: gfortran.dg/erf_3.F90   -Os  execution test
Comment 1 Dominique d'Humieres 2014-11-17 17:22:44 UTC
Same thing on x86_64-apple-darwin14.
Comment 2 Zhenqiang Chen 2014-11-18 05:38:31 UTC
Thanks for the report. I can reproduce the FAIL on IA32. Since the patch does not impact on -O0, it seams some library functions are wrong. I will investigate it.
Comment 3 Zhenqiang Chen 2014-11-18 09:45:19 UTC
Root cause: r217646 enhances ifcvt to handle cbranchcc4 instruction. But ifcvt does not check whether an insn will clobber CC or not, when moving it before the cbranchcc4 instruction.

I will work out a patch to fix it.
Comment 4 Christophe Lyon 2014-11-20 14:16:34 UTC
On aarch64, I have noticed that the following tests FAIL after r217646:
  gcc.target/aarch64/test_frame_1.c scan-assembler-times ldr\tx30, \\[sp\\], [0-9]+ 3
  gcc.target/aarch64/test_frame_2.c scan-assembler-times ldp\tx19, x30, \\[sp\\], [0-9]+ 2
  gcc.target/aarch64/test_frame_4.c scan-assembler-times ldp\tx19, x30, \\[sp\\], [0-9]+ 2
  gcc.target/aarch64/test_frame_6.c scan-assembler-times ldr\tx30, \\[sp\\], [0-9]+ 3
  gcc.target/aarch64/test_frame_7.c scan-assembler-times ldp\tx19, x30, \\[sp\\], [0-9]+ 2

(tested on aarch64 and aarch64_be)
Comment 5 Andrew Pinski 2014-11-20 14:30:42 UTC
(In reply to clyon from comment #4)
> On aarch64, I have noticed that the following tests FAIL after r217646:

That is recorded as bug 63971 and just a testsuite issue. In that the return is no longer duplicated so the loads are not either. Anyways I have a fix which I will be posting this weekend. 


>   gcc.target/aarch64/test_frame_1.c scan-assembler-times ldr\tx30, \\[sp\\],
> [0-9]+ 3
>   gcc.target/aarch64/test_frame_2.c scan-assembler-times ldp\tx19, x30,
> \\[sp\\], [0-9]+ 2
>   gcc.target/aarch64/test_frame_4.c scan-assembler-times ldp\tx19, x30,
> \\[sp\\], [0-9]+ 2
>   gcc.target/aarch64/test_frame_6.c scan-assembler-times ldr\tx30, \\[sp\\],
> [0-9]+ 3
>   gcc.target/aarch64/test_frame_7.c scan-assembler-times ldp\tx19, x30,
> \\[sp\\], [0-9]+ 2
> 
> (tested on aarch64 and aarch64_be)
Comment 6 H.J. Lu 2014-11-21 01:27:55 UTC
*** Bug 64007 has been marked as a duplicate of this bug. ***
Comment 7 Bernd Edlinger 2014-11-22 12:11:01 UTC
also gmp-4.3.2/mpz/n_pow_ui.c is miscompiled because of this.
Comment 8 Francois-Xavier Coudert 2014-12-04 12:02:36 UTC
(In reply to Zhenqiang Chen from comment #3)
> Root cause: r217646 enhances ifcvt to handle cbranchcc4 instruction. But
> ifcvt does not check whether an insn will clobber CC or not, when moving it
> before the cbranchcc4 instruction.

This is a clear and important regression, miscompiling real-life code. Can we get this fixed, or should we ask to revert 217646 until this is fixed?
Comment 9 Dominique d'Humieres 2014-12-05 14:36:06 UTC
A patch has been submitted at https://gcc.gnu.org/ml/gcc-patches/2014-12/msg00478.html waiting for approval!-(
Comment 10 zqchen 2014-12-12 05:51:51 UTC
Author: zqchen
Date: Fri Dec 12 05:51:19 2014
New Revision: 218658

URL: https://gcc.gnu.org/viewcvs?rev=218658&root=gcc&view=rev
Log:
2014-12-12  Zhenqiang Chen  <zhenqiang.chen@arm.com>

	PR rtl-optimization/63917
	* ifcvt.c (cc_in_cond): New function.
	(end_ifcvt_sequence): Make sure new generated insns do not clobber CC.
	(noce_process_if_block, check_cond_move_block): Check CC references.

testsuite/ChangeLog:
2014-12-12  Zhenqiang Chen  <zhenqiang.chen@arm.com>

	* gcc.dg/pr64007.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr64007.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ifcvt.c
    trunk/gcc/testsuite/ChangeLog
Comment 11 Markus Trippelsdorf 2014-12-12 09:01:24 UTC
Fixed.
Comment 12 Yvan Roux 2015-04-07 13:24:36 UTC
Author: yroux
Date: Tue Apr  7 13:24:05 2015
New Revision: 221894

URL: https://gcc.gnu.org/viewcvs?rev=221894&root=gcc&view=rev
Log:
gcc/
2015-04-07  Yvan Roux  <yvan.roux@linaro.org>

	Backport from trunk r217062, r217646, r218658.
	2014-12-12  Zhenqiang Chen  <zhenqiang.chen@arm.com>

	PR rtl-optimization/63917
	* ifcvt.c (cc_in_cond): New function.
	(end_ifcvt_sequence): Make sure new generated insns do not clobber CC.
	(noce_process_if_block, check_cond_move_block): Check CC references.

	2014-11-17  Zhenqiang Chen  <zhenqiang.chen@arm.com>

	* ifcvt.c (HAVE_cbranchcc4): Define.
	(noce_emit_cmove, noce_get_alt_condition, noce_get_condition):
	Use HAVE_cbranchcc4.

	2014-11-04  Zhenqiang Chen  <zhenqiang.chen@arm.com>

	Revert:
		2014-11-03  Zhenqiang Chen  <zhenqiang.chen@arm.com>
	* ifcvt.c (noce_emit_cmove, noce_get_alt_condition, noce_get_condition):
	Allow CC mode if HAVE_cbranchcc4.

gcc/testsuite/
2015-04-07  Yvan Roux  <yvan.roux@linaro.org>

	Backport from trunk r218658.
	2014-12-12  Zhenqiang Chen  <zhenqiang.chen@arm.com>

	* gcc.dg/pr64007.c: New test.


Added:
    branches/linaro/gcc-4_9-branch/gcc/testsuite/gcc.dg/pr64007.c
Modified:
    branches/linaro/gcc-4_9-branch/gcc/ChangeLog.linaro
    branches/linaro/gcc-4_9-branch/gcc/ifcvt.c
    branches/linaro/gcc-4_9-branch/gcc/testsuite/ChangeLog.linaro