aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2016-01-12 16:25:46 +0100
committerLinaro Code Review <review@review.linaro.org>2016-01-13 09:56:41 +0000
commit428ded17977c8142625804eb8f7545ae7bb06f7b (patch)
tree62dc59eef237f76cc5179402002a1d5a90118d32
parent70d504cf4dac578be53e6513ca9ed8a8adc2cdb3 (diff)
gcc/
Backport from trunk r230786. 2015-11-24 Segher Boessenkool <segher@kernel.crashing.org> PR rtl-optimization/68381 * combine.c (is_parallel_of_n_reg_sets): Return false if the pattern is poisoned. gcc/testsuite/ Backport from trunk r230809. 2015-11-24 Kyrylo Tkachov <kyrylo.tkachov@arm.com> PR rtl-optimization/68381 * gcc.c-torture/execute/pr68381.c: New test. gcc/ Backport from trunk r230946. 2015-11-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com> * combine.c (subst): Do not return clobber of zero in widening mult case. Just return x unchanged if it is a no-op substitution. Change-Id: I3a644b62bce1ddd7d24ebd3b2c604076e040d755
-rw-r--r--gcc/combine.c16
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr68381.c22
2 files changed, 29 insertions, 9 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index ba9dd61626f..c903db2c8b0 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2558,7 +2558,8 @@ is_parallel_of_n_reg_sets (rtx pat, int n)
|| !REG_P (SET_DEST (XVECEXP (pat, 0, i))))
return false;
for ( ; i < len; i++)
- if (GET_CODE (XVECEXP (pat, 0, i)) != CLOBBER)
+ if (GET_CODE (XVECEXP (pat, 0, i)) != CLOBBER
+ || XEXP (XVECEXP (pat, 0, i), 0) == const0_rtx)
return false;
return true;
@@ -5316,7 +5317,7 @@ subst (rtx x, rtx from, rtx to, int in_dest, int in_cond, int unique_copy)
|| GET_CODE (SET_DEST (x)) == PC))
fmt = "ie";
- /* Substituting into the operands of a widening MULT is not likely
+ /* Trying to simplify the operands of a widening MULT is not likely
to create RTL matching a machine insn. */
if (code == MULT
&& (GET_CODE (XEXP (x, 0)) == ZERO_EXTEND
@@ -5324,13 +5325,10 @@ subst (rtx x, rtx from, rtx to, int in_dest, int in_cond, int unique_copy)
&& (GET_CODE (XEXP (x, 1)) == ZERO_EXTEND
|| GET_CODE (XEXP (x, 1)) == SIGN_EXTEND)
&& REG_P (XEXP (XEXP (x, 0), 0))
- && REG_P (XEXP (XEXP (x, 1), 0)))
- {
- if (from == to)
- return x;
- else
- return gen_rtx_CLOBBER (GET_MODE (x), const0_rtx);
- }
+ && REG_P (XEXP (XEXP (x, 1), 0))
+ && from == to)
+ return x;
+
/* Get the mode of operand 0 in case X is now a SIGN_EXTEND of a
constant. */
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr68381.c b/gcc/testsuite/gcc.c-torture/execute/pr68381.c
new file mode 100644
index 00000000000..cb6abcb265b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr68381.c
@@ -0,0 +1,22 @@
+/* { dg-options "-O -fexpensive-optimizations -fno-tree-bit-ccp" } */
+
+__attribute__ ((noinline, noclone))
+int
+foo (unsigned short x, unsigned short y)
+{
+ int r;
+ if (__builtin_mul_overflow (x, y, &r))
+ __builtin_abort ();
+ return r;
+}
+
+int
+main (void)
+{
+ int x = 1;
+ int y = 2;
+ if (foo (x, y) != x * y)
+ __builtin_abort ();
+ return 0;
+}
+