aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-06 10:51:12 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-06 10:51:12 +0000
commit5cf4e6c655566d64e041044b4d19b6518260b016 (patch)
treecf4e76ce170d26d5f39dd3a0871903f4562d3c2a
parent0a462e14583cf7742e7c67f7e6d3470c2615d3e8 (diff)
parenta6bd1ea936a0301c986aefe1ec51b43e65d1e6ca (diff)
svn merge -r234741:234776 svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branchredhat/gcc-5-branch
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/redhat/gcc-5-branch@234777 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog119
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/alias.c14
-rw-r--r--gcc/builtins.c2
-rw-r--r--gcc/config/i386/sse.md8
-rw-r--r--gcc/config/pa/predicates.md6
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/dse.c7
-rw-r--r--gcc/fold-const.c15
-rw-r--r--gcc/gimple-expr.c4
-rw-r--r--gcc/gimple-expr.h10
-rw-r--r--gcc/gimple.c4
-rw-r--r--gcc/ipa-prop.c3
-rw-r--r--gcc/rtl.h2
-rw-r--r--gcc/testsuite/ChangeLog68
-rw-r--r--gcc/testsuite/g++.dg/ext/vector30.C15
-rw-r--r--gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr70022.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr70177.c15
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr68963.c41
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr69760.c50
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr70115.c20
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr70333.c19
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr70450.c19
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr70484.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/pr70510.c14
-rw-r--r--gcc/tree-chrec.c12
-rw-r--r--gcc/tree-scalar-evolution.c70
-rw-r--r--gcc/tree-ssa-forwprop.c2
-rw-r--r--gcc/tree-ssa-loop-ivcanon.c36
-rw-r--r--gcc/tree-ssa-loop-niter.c18
32 files changed, 544 insertions, 93 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f7e293d4a2a..7f8f8578bed 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,113 @@
+2016-04-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-03-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/70177
+ * gimple-expr.h (extract_ops_from_tree_1): Renamed to ...
+ (extract_ops_from_tree): ... this. In the 2 argument
+ overload remove _1 suffix.
+ * gimple-expr.c (extract_ops_from_tree_1): Renamed to ...
+ (extract_ops_from_tree): ... this.
+ * gimple.c (gimple_build_assign, gimple_assign_set_rhs_from_tree):
+ Adjust callers.
+ * tree-ssa-loop-niter.c (derive_constant_upper_bound): Likewise.
+ * tree-ssa-forwprop.c (defcodefor_name): Call 3 operand
+ extract_ops_from_tree instead of 2 operand one.
+
+2016-04-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-02-24 Richard Biener <rguenther@suse.de>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/69760
+ * tree-scalar-evolution.c (interpret_rhs_expr): Re-write
+ conditionally executed ops to well-defined overflow behavior.
+
+ 2016-03-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/69983
+ * tree-chrec.c (eq_evolutions_p): Handle conversions, compare
+ types and fall back to operand_equal_p.
+
+2016-04-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-02-24 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/68963
+ * tree-ssa-loop-niter.c (derive_constant_upper_bound_ops): Fix
+ bogus check.
+ (record_nonwrapping_iv): Do not fall back to the low/high bound
+ for non-constant IV bases if the stmt is not always executed.
+
+2016-04-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-03-01 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/70022
+ * fold-const.c (fold_indirect_ref_1): Fix range checking for
+ vector BIT_FIELD_REF extract.
+
+ 2016-03-07 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/70115
+ * tree-ssa-loop-ivcanon.c (propagate_into_all_uses): Remove.
+ (propagate_constants_for_unrolling): Use replace_uses_by.
+
+ 2016-03-29 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/70424
+ * ipa-prop.c (ipa_compute_jump_functions_for_edge): Always
+ use alignment returned by get_pointer_alignment_1 if it is
+ bigger than BITS_PER_UNIT.
+ * builtins.c (get_pointer_alignment_1): Do not return true
+ for alignment extracted from SSA info.
+
+2016-04-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-03-30 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/70450
+ * fold-const.c (extract_muldiv_1): Fix thinko in wide_int::from
+ usage.
+
+ 2016-03-22 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/70333
+ * fold-const.c (extract_muldiv_1): Properly perform multiplication
+ in the wide type.
+
+ 2016-04-04 Richard Biener <rguenther@suse.de>
+
+ PR rtl-optimization/70484
+ * rtl.h (canon_output_dependence): Declare.
+ * alias.c (canon_output_dependence): New function.
+ * dse.c (record_store): Use canon_output_dependence rather
+ than canon_true_dependence.
+
+2016-04-05 John David Anglin <danglin@gcc.gnu.org>
+
+ * config/pa/predicates.md (integer_store_memory_operand): Accept
+ REG+D operands with a large offset when reload_in_progress is true.
+ (floating_point_store_memory_operand): Likewise.
+
+2016-04-05 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2015-12-08 Kirill Yukhin <kirill.yukhin@intel.com>
+
+ * config/i386/sse.md (define_insn "<avx512>_vec_dup<mode>_1"): Fix
+ assembler to make source always 128bit.
+
+2016-04-05 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/70510
+ * config/i386/sse.md (iptr): Add V64QI, V32HI, V16SI and V8DI modes.
+
2016-04-05 Jakub Jelinek <jakub@redhat.com>
PR target/70525
@@ -301,8 +411,8 @@
2016-03-28 Kirill Yukhin <kirill.yukhin@intel.com>
- PR target/70406
- * config/i386/i386.md (define_split, andn): Fix modes.
+ PR target/70406
+ * config/i386/i386.md (define_split, andn): Fix modes.
2016-03-24 John David Anglin <danglin@gcc.gnu.org>
@@ -312,7 +422,7 @@
2016-03-22 Martin Liska <mliska@suse.cz>
backport from trunk:
-
+
2016-03-21 Martin Liska <mliska@suse.cz>
PR ipa/70306
@@ -323,8 +433,7 @@
PR target/70325
* config/i386/i386.c (def_builtin): Handle
- OPTION_MASK_ISA_AVX512VL to be and-ed with other
- bits.
+ OPTION_MASK_ISA_AVX512VL to be and-ed with other bits.
(const struct builtin_description bdesc_special_args[]):
Remove duplicate ISA bits.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index b7e490e5c72..c7108ab5ccc 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20160405
+20160406
diff --git a/gcc/alias.c b/gcc/alias.c
index 5d2d3333c9a..6949a157d4a 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -2700,6 +2700,20 @@ output_dependence (const_rtx mem, const_rtx x)
/*mem_canonicalized=*/false,
/*x_canonicalized*/false, /*writep=*/true);
}
+
+/* Likewise, but we already have a canonicalized MEM, and X_ADDR for X.
+ Also, consider X in X_MODE (which might be from an enclosing
+ STRICT_LOW_PART / ZERO_EXTRACT).
+ If MEM_CANONICALIZED is true, MEM is canonicalized. */
+
+int
+canon_output_dependence (const_rtx mem, bool mem_canonicalized,
+ const_rtx x, machine_mode x_mode, rtx x_addr)
+{
+ return write_dependence_p (mem, x, x_mode, x_addr,
+ mem_canonicalized, /*x_canonicalized=*/true,
+ /*writep=*/true);
+}
diff --git a/gcc/builtins.c b/gcc/builtins.c
index e7fc95677c8..18b4c344003 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -502,7 +502,7 @@ get_pointer_alignment_1 (tree exp, unsigned int *alignp,
if (*alignp == 0)
*alignp = 1u << (HOST_BITS_PER_INT - 1);
/* We cannot really tell whether this result is an approximation. */
- return true;
+ return false;
}
else
{
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 720ea143dee..f8771dc7f63 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -677,7 +677,8 @@
;; Pointer size override for scalar modes (Intel asm dialect)
(define_mode_attr iptr
- [(V32QI "b") (V16HI "w") (V8SI "k") (V4DI "q")
+ [(V64QI "b") (V32HI "w") (V16SI "k") (V8DI "q")
+ (V32QI "b") (V16HI "w") (V8SI "k") (V4DI "q")
(V16QI "b") (V8HI "w") (V4SI "k") (V2DI "q")
(V8SF "k") (V4DF "q")
(V4SF "k") (V2DF "q")
@@ -16641,8 +16642,9 @@
(match_operand:VI_AVX512BW 1 "nonimmediate_operand" "v,m")
(parallel [(const_int 0)]))))]
"TARGET_AVX512F"
- "vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
- vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}"
+ "@
+ vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
+ vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %<iptr>1}"
[(set_attr "type" "ssemov")
(set_attr "prefix" "evex")
(set_attr "mode" "<sseinsnmode>")])
diff --git a/gcc/config/pa/predicates.md b/gcc/config/pa/predicates.md
index fcf68462d4c..aa9c10460c8 100644
--- a/gcc/config/pa/predicates.md
+++ b/gcc/config/pa/predicates.md
@@ -301,6 +301,9 @@
if (reg_plus_base_memory_operand (op, mode))
{
+ if (reload_in_progress)
+ return true;
+
/* Extract CONST_INT operand. */
if (GET_CODE (op) == SUBREG)
op = SUBREG_REG (op);
@@ -335,6 +338,9 @@
if (reg_plus_base_memory_operand (op, mode))
{
+ if (reload_in_progress)
+ return true;
+
/* Extract CONST_INT operand. */
if (GET_CODE (op) == SUBREG)
op = SUBREG_REG (op);
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 862eda971f0..646862f013b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+2016-04-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-03-31 Richard Biener <rguenther@suse.de>
+
+ PR c++/70430
+ * typeck.c (cp_build_binary_op): Fix operand order of vector
+ conditional in truth op handling.
+
2016-03-31 Nathan Sidwell <nathan@acm.org>
PR c++/70393
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index e79c71e2081..9e438c9297f 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4233,7 +4233,7 @@ cp_build_binary_op (location_t location,
{
tree m1 = build_all_ones_cst (TREE_TYPE (op0));
tree z = build_zero_cst (TREE_TYPE (op0));
- op1 = build_conditional_expr (location, op1, z, m1, complain);
+ op1 = build_conditional_expr (location, op1, m1, z, complain);
}
else if (!COMPARISON_CLASS_P (op1))
op1 = cp_build_binary_op (EXPR_LOCATION (op1), NE_EXPR, op1,
diff --git a/gcc/dse.c b/gcc/dse.c
index 6fdee17ec67..4e195c2a5c6 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -1665,10 +1665,9 @@ record_store (rtx body, bb_info_t bb_info)
the value of store_info. If it is, set the rhs to NULL to
keep it from being used to remove a load. */
{
- if (canon_true_dependence (s_info->mem,
- GET_MODE (s_info->mem),
- s_info->mem_addr,
- mem, mem_addr))
+ if (canon_output_dependence (s_info->mem, true,
+ mem, GET_MODE (mem),
+ mem_addr))
{
s_info->rhs = NULL;
s_info->const_rhs = NULL;
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 844b8f776d2..2a26beb39f6 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -6241,18 +6241,19 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
bool overflow_p = false;
bool overflow_mul_p;
signop sign = TYPE_SIGN (ctype);
- wide_int mul = wi::mul (op1, c, sign, &overflow_mul_p);
+ unsigned prec = TYPE_PRECISION (ctype);
+ wide_int mul = wi::mul (wide_int::from (op1, prec,
+ TYPE_SIGN (TREE_TYPE (op1))),
+ wide_int::from (c, prec,
+ TYPE_SIGN (TREE_TYPE (c))),
+ sign, &overflow_mul_p);
overflow_p = TREE_OVERFLOW (c) | TREE_OVERFLOW (op1);
if (overflow_mul_p
&& ((sign == UNSIGNED && tcode != MULT_EXPR) || sign == SIGNED))
overflow_p = true;
if (!overflow_p)
- {
- mul = wide_int::from (mul, TYPE_PRECISION (ctype),
- TYPE_SIGN (TREE_TYPE (op1)));
- return fold_build2 (tcode, ctype, fold_convert (ctype, op0),
- wide_int_to_tree (ctype, mul));
- }
+ return fold_build2 (tcode, ctype, fold_convert (ctype, op0),
+ wide_int_to_tree (ctype, mul));
}
/* If these operations "cancel" each other, we have the main
diff --git a/gcc/gimple-expr.c b/gcc/gimple-expr.c
index f555189a541..22cb5add1fe 100644
--- a/gcc/gimple-expr.c
+++ b/gcc/gimple-expr.c
@@ -570,8 +570,8 @@ create_tmp_reg_fn (struct function *fn, tree type, const char *prefix)
*OP1_P, *OP2_P and *OP3_P respectively. */
void
-extract_ops_from_tree_1 (tree expr, enum tree_code *subcode_p, tree *op1_p,
- tree *op2_p, tree *op3_p)
+extract_ops_from_tree (tree expr, enum tree_code *subcode_p, tree *op1_p,
+ tree *op2_p, tree *op3_p)
{
enum gimple_rhs_class grhs_class;
diff --git a/gcc/gimple-expr.h b/gcc/gimple-expr.h
index a50a90a959b..20815b098b8 100644
--- a/gcc/gimple-expr.h
+++ b/gcc/gimple-expr.h
@@ -36,8 +36,8 @@ extern tree create_tmp_reg (tree, const char * = NULL);
extern tree create_tmp_reg_fn (struct function *, tree, const char *);
-extern void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *,
- tree *);
+extern void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *,
+ tree *);
extern void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *,
tree *);
extern bool is_gimple_lvalue (tree);
@@ -146,15 +146,15 @@ is_gimple_constant (const_tree t)
}
}
-/* A wrapper around extract_ops_from_tree_1, for callers which expect
- to see only a maximum of two operands. */
+/* A wrapper around extract_ops_from_tree with 3 ops, for callers which
+ expect to see only a maximum of two operands. */
static inline void
extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
tree *op1)
{
tree op2;
- extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
+ extract_ops_from_tree (expr, code, op0, op1, &op2);
gcc_assert (op2 == NULL_TREE);
}
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 1f31914d0fe..a0e542fa47d 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -411,7 +411,7 @@ gimple_build_assign (tree lhs, tree rhs MEM_STAT_DECL)
enum tree_code subcode;
tree op1, op2, op3;
- extract_ops_from_tree_1 (rhs, &subcode, &op1, &op2, &op3);
+ extract_ops_from_tree (rhs, &subcode, &op1, &op2, &op3);
return gimple_build_assign (lhs, subcode, op1, op2, op3 PASS_MEM_STAT);
}
@@ -1595,7 +1595,7 @@ gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *gsi, tree expr)
enum tree_code subcode;
tree op1, op2, op3;
- extract_ops_from_tree_1 (expr, &subcode, &op1, &op2, &op3);
+ extract_ops_from_tree (expr, &subcode, &op1, &op2, &op3);
gimple_assign_set_rhs_with_ops (gsi, subcode, op1, op2, op3);
}
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 9298fac9d56..747ab18f845 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -1683,7 +1683,8 @@ ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi,
unsigned HOST_WIDE_INT hwi_bitpos;
unsigned align;
- if (get_pointer_alignment_1 (arg, &align, &hwi_bitpos)
+ get_pointer_alignment_1 (arg, &align, &hwi_bitpos);
+ if (align > BITS_PER_UNIT
&& align % BITS_PER_UNIT == 0
&& hwi_bitpos % BITS_PER_UNIT == 0)
{
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 59c60f5716d..22e50f36bed 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3521,6 +3521,8 @@ extern int anti_dependence (const_rtx, const_rtx);
extern int canon_anti_dependence (const_rtx, bool,
const_rtx, machine_mode, rtx);
extern int output_dependence (const_rtx, const_rtx);
+extern int canon_output_dependence (const_rtx, bool,
+ const_rtx, machine_mode, rtx);
extern int may_alias_p (const_rtx, const_rtx);
extern void init_alias_target (void);
extern void init_alias_analysis (void);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bb943d3198f..2d5576355a9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,69 @@
+2016-04-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-03-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/70177
+ * gcc.dg/pr70177.c: New test.
+
+2016-04-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-02-24 Richard Biener <rguenther@suse.de>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/69760
+ * gcc.dg/torture/pr69760.c: New testcase.
+
+ 2016-03-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/69983
+ * gcc.dg/graphite/isl-codegen-loop-dumping.c: Adjust.
+
+2016-04-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-02-24 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/68963
+ * gcc.dg/torture/pr68963.c: New testcase.
+
+2016-04-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-03-01 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/70022
+ * gcc.dg/pr70022.c: New testcase.
+
+ 2016-03-07 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/70115
+ * gcc.dg/torture/pr70115.c: New testcase.
+
+2016-04-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-03-30 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/70450
+ * gcc.dg/torture/pr70450.c: New testcase.
+
+ 2016-03-22 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/70333
+ * gcc.dg/torture/pr70333.c: New testcase.
+
+ 2016-04-04 Richard Biener <rguenther@suse.de>
+
+ PR rtl-optimization/70484
+ * gcc.dg/torture/pr70484.c: New testcase.
+
+ 2016-03-31 Richard Biener <rguenther@suse.de>
+
+ PR c++/70430
+ * g++.dg/ext/vector30.C: New testcase.
+
2016-04-05 Dominique d'Humieres <dominiq@lps.ens.fr>
Jerry DeLisle <jvdelisle@gcc.gnu.org>
@@ -274,7 +340,7 @@
2016-03-28 Kirill Yukhin <kirill.yukhin@intel.com>
PR target/70406
- * gcc.target/i386/pr70406.c: New test.
+ * gcc.target/i386/pr70406.c: New test.
2016-03-27 Eric Botcazou <ebotcazou@adacore.com>
diff --git a/gcc/testsuite/g++.dg/ext/vector30.C b/gcc/testsuite/g++.dg/ext/vector30.C
new file mode 100644
index 00000000000..68326e3db5b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/vector30.C
@@ -0,0 +1,15 @@
+// PR c++/70430
+// { dg-do run }
+extern "C" void abort (void);
+typedef int v4si __attribute__ ((vector_size (16)));
+int main()
+{
+ v4si b = {1,0,-1,2}, c;
+ c = b && 1;
+ if (c[0] != -1 || c[1] != 0 || c[2] != -1 || c[3] != -1)
+ abort ();
+ c = b && 0;
+ if (c[0] != 0 || c[1] != 0 || c[2] != 0 || c[3] != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c b/gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c
index a2e0aede6ef..0f19b511077 100644
--- a/gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c
+++ b/gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c
@@ -12,5 +12,5 @@ main (int n, int *a)
return 0;
}
-/* { dg-final { scan-tree-dump-times "ISL AST generated by ISL: \nfor \\(int c1 = 0; c1 < n - 1; c1 \\+= 1\\)\n for \\(int c3 = 0; c3 < n; c3 \\+= 1\\)\n S_4\\(c1, c3\\);" 1 "graphite"} } */
+/* { dg-final { scan-tree-dump-times "ISL AST generated by ISL: \nfor \\(int c1 = 0; c1 < n - 1; c1 \\+= 1\\) {\n S_10\\(c1\\);\n for \\(int c3 = 0; c3 < n; c3 \\+= 1\\)\n S_4\\(c1, c3\\);\n}" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/pr70022.c b/gcc/testsuite/gcc.dg/pr70022.c
new file mode 100644
index 00000000000..30eb7ece250
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr70022.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-w -Wno-psabi" } */
+
+typedef int v4si __attribute__ ((vector_size (16)));
+
+int
+foo (v4si v)
+{
+ return v[~0UL];
+}
diff --git a/gcc/testsuite/gcc.dg/pr70177.c b/gcc/testsuite/gcc.dg/pr70177.c
new file mode 100644
index 00000000000..1b2bec11e30
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr70177.c
@@ -0,0 +1,15 @@
+/* PR tree-optimization/70177 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int b[128];
+
+void
+foo (int i, int j)
+{
+ int c, f, g, h;
+ for (g = 0; g < 64; g++)
+ for (h = g, f = 0; f <= i; f++, h++)
+ for (c = 0; c < j; c++)
+ b[h] = 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr68963.c b/gcc/testsuite/gcc.dg/torture/pr68963.c
new file mode 100644
index 00000000000..c83b543fa03
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr68963.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+
+static const float a[3] = { 1, 2, 3 };
+int b = 3;
+
+__attribute__((noinline, noclone)) void
+bar (int x)
+{
+ if (x != b++)
+ __builtin_abort ();
+}
+
+void
+foo (float *x, int y)
+{
+ int i;
+ for (i = 0; i < 2 * y; ++i)
+ {
+ if (i < y)
+ x[i] = a[i];
+ else
+ {
+ bar (i);
+ x[i] = a[i - y];
+ }
+ }
+}
+
+int
+main ()
+{
+ float x[10];
+ unsigned int i;
+ for (i = 0; i < 10; ++i)
+ x[i] = 1337;
+ foo (x, 3);
+ for (i = 0; i < 10; ++i)
+ if (x[i] != (i < 6 ? (i % 3) + 1 : 1337))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr69760.c b/gcc/testsuite/gcc.dg/torture/pr69760.c
new file mode 100644
index 00000000000..8f24608d232
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr69760.c
@@ -0,0 +1,50 @@
+/* PR tree-optimization/69760 */
+/* { dg-do run { target { { *-*-linux* *-*-gnu* } && mmap } } } */
+/* { dg-options "-O2" } */
+
+#include <unistd.h>
+#include <sys/mman.h>
+
+__attribute__((noinline, noclone)) void
+test_func (double *a, int L, int m, int n, int N)
+{
+ int i, k;
+ for (i = 0; i < N; i++)
+ {
+ k = i - m;
+ if (k >= 0 && k < n)
+ a[L * k] = 0.0;
+ }
+}
+
+int
+main ()
+{
+ char *p;
+ int L, m, n, N;
+ long l;
+ L = 10000000;
+ n = 4;
+ N = 100 * n;
+ long pgsz = sysconf(_SC_PAGESIZE);
+ if (pgsz < sizeof (double) || pgsz > L * sizeof (double))
+ return 0;
+ p = mmap ((void *) 0, L * n * sizeof (double), PROT_NONE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (p == MAP_FAILED)
+ return 0;
+ if (mprotect (p, pgsz, PROT_READ | PROT_WRITE))
+ return 0;
+ l = (L * sizeof (double)) / pgsz * pgsz;
+ if (mprotect (p + l, pgsz, PROT_READ | PROT_WRITE))
+ return 0;
+ l = (2 * L * sizeof (double)) / pgsz * pgsz;
+ if (mprotect (p + l, pgsz, PROT_READ | PROT_WRITE))
+ return 0;
+ l = (3 * L * sizeof (double)) / pgsz * pgsz;
+ if (mprotect (p + l, pgsz, PROT_READ | PROT_WRITE))
+ return 0;
+ for (m = 0; m < N; m += n)
+ test_func ((double *) p, L, m, n, N);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr70115.c b/gcc/testsuite/gcc.dg/torture/pr70115.c
new file mode 100644
index 00000000000..0044fe4c2b1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr70115.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+typedef int size_t;
+char a;
+int main()
+{
+ size_t b, c;
+ for (;;)
+ {
+ b = 0;
+ for (; c;)
+ ;
+ for (; b < sizeof(long); b++)
+ ;
+ for (; b < c; b++)
+ a++;
+ for (; c < b; c++)
+ ;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr70333.c b/gcc/testsuite/gcc.dg/torture/pr70333.c
new file mode 100644
index 00000000000..854e6d59e1a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr70333.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-require-effective-target lp64 } */
+
+unsigned long int
+foo (signed char b, signed char e)
+{
+ return ((2ULL * b) * (e * 13)) * (32 << 24);
+}
+
+int
+main ()
+{
+ if (__CHAR_BIT__ == 8
+ && sizeof (int) == 4
+ && sizeof (long long) == 8
+ && foo (-60, 1) != 0xffffff3d00000000ULL)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr70450.c b/gcc/testsuite/gcc.dg/torture/pr70450.c
new file mode 100644
index 00000000000..ee5e24d0522
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr70450.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-require-effective-target lp64 } */
+
+unsigned long int a = 2UL;
+int b = 2;
+unsigned long int c = 2UL;
+
+void foo ()
+{
+ c = 2 * ((2 * a) * (2 * (-b)));
+}
+
+int main ()
+{
+ foo();
+ if (c != 18446744073709551584UL)
+ __builtin_abort();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr70484.c b/gcc/testsuite/gcc.dg/torture/pr70484.c
new file mode 100644
index 00000000000..7604c654fbe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr70484.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+
+extern void abort (void);
+
+int __attribute__((noinline,noclone))
+f(int *pi, long *pl)
+{
+ *pi = 1;
+ *pl = 0;
+ return *(char *)pi;
+}
+
+int main()
+{
+ union { long l; int i; } a;
+ if (f (&a.i, &a.l) != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr70510.c b/gcc/testsuite/gcc.target/i386/pr70510.c
new file mode 100644
index 00000000000..fdad97a16f4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr70510.c
@@ -0,0 +1,14 @@
+/* PR target/70510 */
+/* { dg-do assemble { target avx512bw } } */
+/* { dg-require-effective-target masm_intel } */
+/* { dg-options "-Og -mavx512bw -masm=intel" } */
+
+typedef int V __attribute__ ((vector_size (64)));
+
+V
+foo (V u, V v)
+{
+ v[0] |= v[u[0]];
+ u /= ((V)v)[0];
+ return u;
+}
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index 4f1b6bc2090..1d7bc47192a 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -1464,11 +1464,11 @@ eq_evolutions_p (const_tree chrec0, const_tree chrec1)
if (chrec0 == chrec1)
return true;
+ if (! types_compatible_p (TREE_TYPE (chrec0), TREE_TYPE (chrec1)))
+ return false;
+
switch (TREE_CODE (chrec0))
{
- case INTEGER_CST:
- return operand_equal_p (chrec0, chrec1, 0);
-
case POLYNOMIAL_CHREC:
return (CHREC_VARIABLE (chrec0) == CHREC_VARIABLE (chrec1)
&& eq_evolutions_p (CHREC_LEFT (chrec0), CHREC_LEFT (chrec1))
@@ -1483,8 +1483,12 @@ eq_evolutions_p (const_tree chrec0, const_tree chrec1)
&& eq_evolutions_p (TREE_OPERAND (chrec0, 1),
TREE_OPERAND (chrec1, 1));
+ CASE_CONVERT:
+ return eq_evolutions_p (TREE_OPERAND (chrec0, 0),
+ TREE_OPERAND (chrec1, 0));
+
default:
- return false;
+ return operand_equal_p (chrec0, chrec1, 0);
}
}
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index 1b457059d0e..6f640b82f36 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -1724,7 +1724,7 @@ static tree
interpret_rhs_expr (struct loop *loop, gimple at_stmt,
tree type, tree rhs1, enum tree_code code, tree rhs2)
{
- tree res, chrec1, chrec2;
+ tree res, chrec1, chrec2, ctype;
gimple def;
if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
@@ -1818,30 +1818,63 @@ interpret_rhs_expr (struct loop *loop, gimple at_stmt,
case PLUS_EXPR:
chrec1 = analyze_scalar_evolution (loop, rhs1);
chrec2 = analyze_scalar_evolution (loop, rhs2);
- chrec1 = chrec_convert (type, chrec1, at_stmt);
- chrec2 = chrec_convert (type, chrec2, at_stmt);
+ ctype = type;
+ /* When the stmt is conditionally executed re-write the CHREC
+ into a form that has well-defined behavior on overflow. */
+ if (at_stmt
+ && INTEGRAL_TYPE_P (type)
+ && ! TYPE_OVERFLOW_WRAPS (type)
+ && ! dominated_by_p (CDI_DOMINATORS, loop->latch,
+ gimple_bb (at_stmt)))
+ ctype = unsigned_type_for (type);
+ chrec1 = chrec_convert (ctype, chrec1, at_stmt);
+ chrec2 = chrec_convert (ctype, chrec2, at_stmt);
chrec1 = instantiate_parameters (loop, chrec1);
chrec2 = instantiate_parameters (loop, chrec2);
- res = chrec_fold_plus (type, chrec1, chrec2);
+ res = chrec_fold_plus (ctype, chrec1, chrec2);
+ if (type != ctype)
+ res = chrec_convert (type, res, at_stmt);
break;
case MINUS_EXPR:
chrec1 = analyze_scalar_evolution (loop, rhs1);
chrec2 = analyze_scalar_evolution (loop, rhs2);
- chrec1 = chrec_convert (type, chrec1, at_stmt);
- chrec2 = chrec_convert (type, chrec2, at_stmt);
+ ctype = type;
+ /* When the stmt is conditionally executed re-write the CHREC
+ into a form that has well-defined behavior on overflow. */
+ if (at_stmt
+ && INTEGRAL_TYPE_P (type)
+ && ! TYPE_OVERFLOW_WRAPS (type)
+ && ! dominated_by_p (CDI_DOMINATORS,
+ loop->latch, gimple_bb (at_stmt)))
+ ctype = unsigned_type_for (type);
+ chrec1 = chrec_convert (ctype, chrec1, at_stmt);
+ chrec2 = chrec_convert (ctype, chrec2, at_stmt);
chrec1 = instantiate_parameters (loop, chrec1);
chrec2 = instantiate_parameters (loop, chrec2);
- res = chrec_fold_minus (type, chrec1, chrec2);
+ res = chrec_fold_minus (ctype, chrec1, chrec2);
+ if (type != ctype)
+ res = chrec_convert (type, res, at_stmt);
break;
case NEGATE_EXPR:
chrec1 = analyze_scalar_evolution (loop, rhs1);
- chrec1 = chrec_convert (type, chrec1, at_stmt);
+ ctype = type;
+ /* When the stmt is conditionally executed re-write the CHREC
+ into a form that has well-defined behavior on overflow. */
+ if (at_stmt
+ && INTEGRAL_TYPE_P (type)
+ && ! TYPE_OVERFLOW_WRAPS (type)
+ && ! dominated_by_p (CDI_DOMINATORS,
+ loop->latch, gimple_bb (at_stmt)))
+ ctype = unsigned_type_for (type);
+ chrec1 = chrec_convert (ctype, chrec1, at_stmt);
/* TYPE may be integer, real or complex, so use fold_convert. */
chrec1 = instantiate_parameters (loop, chrec1);
- res = chrec_fold_multiply (type, chrec1,
- fold_convert (type, integer_minus_one_node));
+ res = chrec_fold_multiply (ctype, chrec1,
+ fold_convert (ctype, integer_minus_one_node));
+ if (type != ctype)
+ res = chrec_convert (type, res, at_stmt);
break;
case BIT_NOT_EXPR:
@@ -1857,11 +1890,22 @@ interpret_rhs_expr (struct loop *loop, gimple at_stmt,
case MULT_EXPR:
chrec1 = analyze_scalar_evolution (loop, rhs1);
chrec2 = analyze_scalar_evolution (loop, rhs2);
- chrec1 = chrec_convert (type, chrec1, at_stmt);
- chrec2 = chrec_convert (type, chrec2, at_stmt);
+ ctype = type;
+ /* When the stmt is conditionally executed re-write the CHREC
+ into a form that has well-defined behavior on overflow. */
+ if (at_stmt
+ && INTEGRAL_TYPE_P (type)
+ && ! TYPE_OVERFLOW_WRAPS (type)
+ && ! dominated_by_p (CDI_DOMINATORS,
+ loop->latch, gimple_bb (at_stmt)))
+ ctype = unsigned_type_for (type);
+ chrec1 = chrec_convert (ctype, chrec1, at_stmt);
+ chrec2 = chrec_convert (ctype, chrec2, at_stmt);
chrec1 = instantiate_parameters (loop, chrec1);
chrec2 = instantiate_parameters (loop, chrec2);
- res = chrec_fold_multiply (type, chrec1, chrec2);
+ res = chrec_fold_multiply (ctype, chrec1, chrec2);
+ if (type != ctype)
+ res = chrec_convert (type, res, at_stmt);
break;
CASE_CONVERT:
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 93f92f33a59..a1ba1e09d79 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -1517,7 +1517,7 @@ defcodefor_name (tree name, enum tree_code *code, tree *arg1, tree *arg2)
|| GIMPLE_BINARY_RHS
|| GIMPLE_UNARY_RHS
|| GIMPLE_SINGLE_RHS)
- extract_ops_from_tree_1 (name, &code1, &arg11, &arg21, &arg31);
+ extract_ops_from_tree (name, &code1, &arg11, &arg21, &arg31);
*code = code1;
*arg1 = arg11;
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 138468d396a..f97c81912a6 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -1193,38 +1193,6 @@ canonicalize_induction_variables (void)
return 0;
}
-/* Propagate VAL into all uses of SSA_NAME. */
-
-static void
-propagate_into_all_uses (tree ssa_name, tree val)
-{
- imm_use_iterator iter;
- gimple use_stmt;
-
- FOR_EACH_IMM_USE_STMT (use_stmt, iter, ssa_name)
- {
- gimple_stmt_iterator use_stmt_gsi = gsi_for_stmt (use_stmt);
- use_operand_p use;
-
- FOR_EACH_IMM_USE_ON_STMT (use, iter)
- SET_USE (use, val);
-
- if (is_gimple_assign (use_stmt)
- && get_gimple_rhs_class (gimple_assign_rhs_code (use_stmt))
- == GIMPLE_SINGLE_RHS)
- {
- tree rhs = gimple_assign_rhs1 (use_stmt);
-
- if (TREE_CODE (rhs) == ADDR_EXPR)
- recompute_tree_invariant_for_addr_expr (rhs);
- }
-
- fold_stmt_inplace (&use_stmt_gsi);
- update_stmt (use_stmt);
- maybe_clean_or_replace_eh_stmt (use_stmt, use_stmt);
- }
-}
-
/* Propagate constant SSA_NAMEs defined in basic block BB. */
static void
@@ -1241,7 +1209,7 @@ propagate_constants_for_unrolling (basic_block bb)
&& gimple_phi_num_args (phi) == 1
&& TREE_CODE (arg) == INTEGER_CST)
{
- propagate_into_all_uses (result, arg);
+ replace_uses_by (result, arg);
gsi_remove (&gsi, true);
release_ssa_name (result);
}
@@ -1260,7 +1228,7 @@ propagate_constants_for_unrolling (basic_block bb)
&& (lhs = gimple_assign_lhs (stmt), TREE_CODE (lhs) == SSA_NAME)
&& !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
{
- propagate_into_all_uses (lhs, gimple_assign_rhs1 (stmt));
+ replace_uses_by (lhs, gimple_assign_rhs1 (stmt));
gsi_remove (&gsi, true);
release_ssa_name (lhs);
}
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index fc63825904f..8db3a34dca5 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -2489,9 +2489,9 @@ static widest_int
derive_constant_upper_bound (tree val)
{
enum tree_code code;
- tree op0, op1;
+ tree op0, op1, op2;
- extract_ops_from_tree (val, &code, &op0, &op1);
+ extract_ops_from_tree (val, &code, &op0, &op1, &op2);
return derive_constant_upper_bound_ops (TREE_TYPE (val), op0, code, op1);
}
@@ -2504,7 +2504,7 @@ derive_constant_upper_bound_ops (tree type, tree op0,
enum tree_code code, tree op1)
{
tree subtype, maxt;
- widest_int bnd, max, mmax, cst;
+ widest_int bnd, max, cst;
gimple stmt;
if (INTEGRAL_TYPE_P (type))
@@ -2570,8 +2570,8 @@ derive_constant_upper_bound_ops (tree type, tree op0,
/* OP0 + CST. We need to check that
BND <= MAX (type) - CST. */
- mmax -= cst;
- if (wi::ltu_p (bnd, max))
+ widest_int mmax = max - cst;
+ if (wi::leu_p (bnd, mmax))
return max;
return bnd + cst;
@@ -2788,7 +2788,9 @@ record_nonwrapping_iv (struct loop *loop, tree base, tree step, gimple stmt,
&& get_range_info (orig_base, &min, &max) == VR_RANGE
&& wi::gts_p (high, max))
base = wide_int_to_tree (unsigned_type, max);
- else if (TREE_CODE (base) != INTEGER_CST)
+ else if (TREE_CODE (base) != INTEGER_CST
+ && dominated_by_p (CDI_DOMINATORS,
+ loop->latch, gimple_bb (stmt)))
base = fold_convert (unsigned_type, high);
delta = fold_build2 (MINUS_EXPR, unsigned_type, base, extreme);
step = fold_build1 (NEGATE_EXPR, unsigned_type, step);
@@ -2803,7 +2805,9 @@ record_nonwrapping_iv (struct loop *loop, tree base, tree step, gimple stmt,
&& get_range_info (orig_base, &min, &max) == VR_RANGE
&& wi::gts_p (min, low))
base = wide_int_to_tree (unsigned_type, min);
- else if (TREE_CODE (base) != INTEGER_CST)
+ else if (TREE_CODE (base) != INTEGER_CST
+ && dominated_by_p (CDI_DOMINATORS,
+ loop->latch, gimple_bb (stmt)))
base = fold_convert (unsigned_type, low);
delta = fold_build2 (MINUS_EXPR, unsigned_type, extreme, base);
}