diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2016-11-30 15:47:01 +0100 |
---|---|---|
committer | Segher Boessenkool <segher@gcc.gnu.org> | 2016-11-30 15:47:01 +0100 |
commit | 17a938e841d439c5ea73b4fcbd7091ae448a9257 (patch) | |
tree | 3a1302d543b539cda495047e59dba693b11caf0d /gcc | |
parent | 88811a9753e9297baf6413267ccd51ff2cea2450 (diff) | |
download | gcc-17a938e841d439c5ea73b4fcbd7091ae448a9257.zip gcc-17a938e841d439c5ea73b4fcbd7091ae448a9257.tar.gz gcc-17a938e841d439c5ea73b4fcbd7091ae448a9257.tar.bz2 |
ira: Don't substitute into TRAP_IF insns (PR78610)
In the testcase, IRA propagates a constant into a TRAP_IF insn, which
then becomes an unconditional trap. Unconditional traps are control
flow insns so doing this requires surgery on the cfg. We cannot do
that here, so instead refuse to do the substitution.
PR rtl-optimization/78610
* ira.c (combine_and_move_insns): Don't substitute into TRAP_IF
instructions.
gcc/testsuite/
PR rtl-optimization/78610
* gcc.c-torture/compile/pr78610.c: New testcase.
From-SVN: r243028
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ira.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr78610.c | 14 |
4 files changed, 30 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0fc87d2..97daa79 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-11-30 Segher Boessenkool <segher@kernel.crashing.org> + + PR rtl-optimization/78610 + * ira.c (combine_and_move_insns): Don't substitute into TRAP_IF + instructions. + 2016-11-30 Bin Cheng <bin.cheng@arm.com> PR tree-optimization/78574 @@ -3669,6 +3669,11 @@ combine_and_move_insns (void) if (JUMP_P (use_insn)) continue; + /* Also don't substitute into a conditional trap insn -- it can become + an unconditional trap, and that is a flow control insn. */ + if (GET_CODE (PATTERN (use_insn)) == TRAP_IF) + continue; + df_ref def = DF_REG_DEF_CHAIN (regno); gcc_assert (DF_REG_DEF_COUNT (regno) == 1 && DF_REF_INSN_INFO (def)); rtx_insn *def_insn = DF_REF_INSN (def); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eac361b..7164611 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-11-30 Segher Boessenkool <segher@kernel.crashing.org> + + PR rtl-optimization/78610 + * gcc.c-torture/compile/pr78610.c: New testcase. + 2016-11-30 Bin Cheng <bin.cheng@arm.com> PR tree-optimization/78574 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr78610.c b/gcc/testsuite/gcc.c-torture/compile/pr78610.c new file mode 100644 index 0000000..0415ae6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr78610.c @@ -0,0 +1,14 @@ +/* PR rtl-optimization/78610 */ + +unsigned int ao, gl; + +void +ri (void) +{ + for (;;) + { + if (ao != 1) + ao /= 0; + gl = 0; + } +} |