aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2023-02-21 21:13:49 +0100
committerThomas Schwinge <thomas@codesourcery.com>2023-02-21 21:13:49 +0100
commit4a4e0b20adf764e8e6ae16c64c130c575ba14aa7 (patch)
tree9f67265e7d4a5499877759c6e1fdc78d772722eb /gcc
parent017e88785acdaf209e7e00e6ed524fb0e2fdc38a (diff)
parentecc863e85efe259c799515de0c38c2297b0e3bd7 (diff)
downloadgcc-4a4e0b20adf764e8e6ae16c64c130c575ba14aa7.zip
gcc-4a4e0b20adf764e8e6ae16c64c130c575ba14aa7.tar.gz
gcc-4a4e0b20adf764e8e6ae16c64c130c575ba14aa7.tar.bz2
Merge commit 'ecc863e85efe259c799515de0c38c2297b0e3bd7' into HEAD
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog46
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/calls.cc10
-rw-r--r--gcc/cfgexpand.cc7
-rw-r--r--gcc/config/i386/i386.md16
-rw-r--r--gcc/config/i386/predicates.md7
-rw-r--r--gcc/config/riscv/riscv.md4
-rw-r--r--gcc/config/rs6000/rs6000.md4
-rw-r--r--gcc/config/xtensa/xtensa.cc7
-rw-r--r--gcc/cp/ChangeLog13
-rw-r--r--gcc/cp/constexpr.cc25
-rw-r--r--gcc/cp/pt.cc9
-rw-r--r--gcc/rust/ChangeLog4
-rw-r--r--gcc/testsuite/ChangeLog28
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-nsdmi3.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-108829-2.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-108829.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-nsdmi10.C18
-rw-r--r--gcc/testsuite/gcc.dg/pr108691.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr108855.c23
-rw-r--r--gcc/testsuite/gcc.dg/pr108862.c27
-rw-r--r--gcc/testsuite/gcc.dg/pr108868.c17
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr108816.c18
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr108862.c6
-rw-r--r--gcc/tree-cfg.cc4
-rw-r--r--gcc/tree-vect-loop-manip.cc3
26 files changed, 281 insertions, 65 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a473929..3ab2938 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,49 @@
+2023-02-20 Uroš Bizjak <ubizjak@gmail.com>
+
+ * config/i386/predicates.md
+ (general_x64constmem_operand): New predicate.
+ * config/i386/i386.md (*cmpqi_ext<mode>_1):
+ Use nonimm_x64constmem_operand.
+ (*cmpqi_ext<mode>_3): Use general_x64constmem_operand.
+ (*addqi_ext<mode>_1): Ditto.
+ (*testqi_ext<mode>_1): Ditto.
+ (*andqi_ext<mode>_1): Ditto.
+ (*andqi_ext<mode>_1_cc): Ditto.
+ (*<any_or:code>qi_ext<mode>_1): Ditto.
+ (*xorqi_ext<mode>_1_cc): Ditto.
+
+2023-02-20 Jakub Jelinek <jakub2redhat.com>
+
+ PR target/108862
+ * config/rs6000/rs6000.md (umaddditi4): Swap gen_maddlddi4 with
+ gen_umadddi4_highpart{,_le}.
+
+2023-02-20 Kito Cheng <kito.cheng@sifive.com>
+
+ * config/riscv/riscv.md (prefetch): Use r instead of p for the
+ address operand.
+ (riscv_prefetchi_<mode>): Ditto.
+
+2023-02-20 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/108816
+ * tree-vect-loop-manip.cc (vect_loop_versioning): Adjust
+ versioning condition split prerequesite, assert required
+ invariant.
+
+2023-02-20 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/108825
+ * tree-ssa-loop-manip.cc (verify_loop_closed_ssa): For
+ loop-local verfication only verify there's no pending SSA
+ update.
+
+2023-02-20 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/108819
+ * tree-ssa-loop-niter.cc (number_of_iterations_cltz): Check
+ we have an SSA name as iv_2 as expected.
+
2023-02-18 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/108819
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 09ddb49..6d7db27 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20230220
+20230221
diff --git a/gcc/calls.cc b/gcc/calls.cc
index 0242d52..4d7f6c3 100644
--- a/gcc/calls.cc
+++ b/gcc/calls.cc
@@ -506,11 +506,11 @@ emit_call_1 (rtx funexp, tree fntree ATTRIBUTE_UNUSED, tree fndecl ATTRIBUTE_UNU
if (ecf_flags & ECF_NORETURN)
add_reg_note (call_insn, REG_NORETURN, const0_rtx);
- if (ecf_flags & ECF_RETURNS_TWICE
- /* We rely on GIMPLE setting this flag and here use it to
- catch formerly indirect and not control-altering calls. */
- && cfun->calls_setjmp)
- add_reg_note (call_insn, REG_SETJMP, const0_rtx);
+ if (ecf_flags & ECF_RETURNS_TWICE)
+ {
+ add_reg_note (call_insn, REG_SETJMP, const0_rtx);
+ cfun->calls_setjmp = 1;
+ }
SIBLING_CALL_P (call_insn) = ((ecf_flags & ECF_SIBCALL) != 0);
diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index ab143a6..25b1558 100644
--- a/gcc/cfgexpand.cc
+++ b/gcc/cfgexpand.cc
@@ -2808,11 +2808,6 @@ expand_call_stmt (gcall *stmt)
/* Must come after copying location. */
copy_warning (exp, stmt);
- /* For calls that do not alter control flow avoid REG_SETJMP notes. */
- bool saved_calls_setjmp = cfun->calls_setjmp;
- if (!gimple_call_ctrl_altering_p (stmt))
- cfun->calls_setjmp = false;
-
/* Ensure RTL is created for debug args. */
if (decl && DECL_HAS_DEBUG_ARGS_P (decl))
{
@@ -2851,8 +2846,6 @@ expand_call_stmt (gcall *stmt)
}
mark_transaction_restart_calls (stmt);
-
- cfun->calls_setjmp = saved_calls_setjmp;
}
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 6382cfb..8ebb12b 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -1456,7 +1456,7 @@
(define_insn "*cmpqi_ext<mode>_1"
[(set (reg FLAGS_REG)
(compare
- (match_operand:QI 0 "nonimmediate_operand" "QBc,m")
+ (match_operand:QI 0 "nonimm_x64constmem_operand" "QBc,m")
(subreg:QI
(zero_extract:SWI248
(match_operand 1 "int248_register_operand" "Q,Q")
@@ -1501,7 +1501,7 @@
(match_operand 0 "int248_register_operand" "Q,Q")
(const_int 8)
(const_int 8)) 0)
- (match_operand:QI 1 "general_operand" "QnBc,m")))]
+ (match_operand:QI 1 "general_x64constmem_operand" "QnBc,m")))]
"ix86_match_ccmode (insn, CCmode)"
"cmp{b}\t{%1, %h0|%h0, %1}"
[(set_attr "isa" "*,nox64")
@@ -6683,7 +6683,7 @@
(match_operand 1 "int248_register_operand" "0,0")
(const_int 8)
(const_int 8)) 0)
- (match_operand:QI 2 "general_operand" "QnBc,m")) 0))
+ (match_operand:QI 2 "general_x64constmem_operand" "QnBc,m")) 0))
(clobber (reg:CC FLAGS_REG))]
"/* FIXME: without this LRA can't reload this pattern, see PR82524. */
rtx_equal_p (operands[0], operands[1])"
@@ -9901,7 +9901,7 @@
(match_operand 0 "int248_register_operand" "Q,Q")
(const_int 8)
(const_int 8)) 0)
- (match_operand:QI 1 "general_operand" "QnBc,m"))
+ (match_operand:QI 1 "general_x64constmem_operand" "QnBc,m"))
(const_int 0)))]
"ix86_match_ccmode (insn, CCNOmode)"
"test{b}\t{%1, %h0|%h0, %1}"
@@ -10602,7 +10602,7 @@
(match_operand 1 "int248_register_operand" "0,0")
(const_int 8)
(const_int 8)) 0)
- (match_operand:QI 2 "general_operand" "QnBc,m")) 0))
+ (match_operand:QI 2 "general_x64constmem_operand" "QnBc,m")) 0))
(clobber (reg:CC FLAGS_REG))]
"/* FIXME: without this LRA can't reload this pattern, see PR82524. */
rtx_equal_p (operands[0], operands[1])"
@@ -10622,7 +10622,7 @@
(match_operand 1 "int248_register_operand" "0,0")
(const_int 8)
(const_int 8)) 0)
- (match_operand:QI 2 "general_operand" "QnBc,m"))
+ (match_operand:QI 2 "general_x64constmem_operand" "QnBc,m"))
(const_int 0)))
(set (zero_extract:SWI248
(match_operand 0 "int248_register_operand" "+Q,Q")
@@ -11345,7 +11345,7 @@
(match_operand 1 "int248_register_operand" "0,0")
(const_int 8)
(const_int 8)) 0)
- (match_operand:QI 2 "general_operand" "QnBc,m")) 0))
+ (match_operand:QI 2 "general_x64constmem_operand" "QnBc,m")) 0))
(clobber (reg:CC FLAGS_REG))]
"(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun))
/* FIXME: without this LRA can't reload this pattern, see PR82524. */
@@ -11473,7 +11473,7 @@
(match_operand 1 "int248_register_operand" "0,0")
(const_int 8)
(const_int 8)) 0)
- (match_operand:QI 2 "general_operand" "QnBc,m"))
+ (match_operand:QI 2 "general_x64constmem_operand" "QnBc,m"))
(const_int 0)))
(set (zero_extract:SWI248
(match_operand 0 "int248_register_operand" "+Q,Q")
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 7b3db0c..b4d9ab4 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -116,6 +116,13 @@
(ior (not (match_test "TARGET_64BIT"))
(match_test "constant_address_p (XEXP (op, 0))")))))
+;; Match general operand, but exclude non-constant addresses for x86_64.
+(define_predicate "general_x64constmem_operand"
+ (ior (match_operand 0 "nonmemory_operand")
+ (and (match_operand 0 "memory_operand")
+ (ior (not (match_test "TARGET_64BIT"))
+ (match_test "constant_address_p (XEXP (op, 0))")))))
+
;; Match register operands, but include memory operands for TARGET_SSE_MATH.
(define_predicate "register_ssemem_operand"
(if_then_else
diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
index 487059e..a5507fad 100644
--- a/gcc/config/riscv/riscv.md
+++ b/gcc/config/riscv/riscv.md
@@ -3066,7 +3066,7 @@
)
(define_insn "prefetch"
- [(prefetch (match_operand 0 "address_operand" "p")
+ [(prefetch (match_operand 0 "address_operand" "r")
(match_operand 1 "imm5_operand" "i")
(match_operand 2 "const_int_operand" "n"))]
"TARGET_ZICBOP"
@@ -3080,7 +3080,7 @@
})
(define_insn "riscv_prefetchi_<mode>"
- [(unspec_volatile:X [(match_operand:X 0 "address_operand" "p")
+ [(unspec_volatile:X [(match_operand:X 0 "address_operand" "r")
(match_operand:X 1 "imm5_operand" "i")]
UNSPECV_PREI)]
"TARGET_ZICBOP"
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 162340b..81bffb0 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -3249,8 +3249,6 @@
rtx op3_hi = gen_rtx_SUBREG (DImode, operands[3], BYTES_BIG_ENDIAN ? 0 : 8);
rtx hi_temp = gen_reg_rtx (DImode);
- emit_insn (gen_maddlddi4 (op0_lo, operands[1], operands[2], op3_lo));
-
if (BYTES_BIG_ENDIAN)
emit_insn (gen_umadddi4_highpart (hi_temp, operands[1], operands[2],
op3_lo));
@@ -3258,6 +3256,8 @@
emit_insn (gen_umadddi4_highpart_le (hi_temp, operands[1], operands[2],
op3_lo));
+ emit_insn (gen_maddlddi4 (op0_lo, operands[1], operands[2], op3_lo));
+
emit_insn (gen_adddi3 (op0_hi, hi_temp, op3_hi));
DONE;
diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc
index 3e2e22d..d0320ef 100644
--- a/gcc/config/xtensa/xtensa.cc
+++ b/gcc/config/xtensa/xtensa.cc
@@ -3223,8 +3223,11 @@ xtensa_call_save_reg (int regno)
return false;
if (regno == A0_REG)
- return crtl->profile || !crtl->is_leaf || crtl->calls_eh_return ||
- df_regs_ever_live_p (regno);
+ /* Ensure the return address to be saved to the stack slot in order
+ to assist stack dump analysis when -Og is specified. */
+ return optimize_debug
+ || crtl->profile || !crtl->is_leaf || crtl->calls_eh_return
+ || df_regs_ever_live_p (regno);
if (crtl->calls_eh_return && IN_RANGE (regno, 2, 3))
return true;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 20b2fe5..302e066 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,16 @@
+2023-02-20 Marek Polacek <polacek@redhat.com>
+
+ PR c++/101073
+ * constexpr.cc (cxx_eval_call_expression): Replace shortcutting trivial
+ constructor/op= with a checking assert.
+
+2023-02-20 Marek Polacek <polacek@redhat.com>
+
+ PR c++/108829
+ * pt.cc (prepend_one_capture): Set LAMBDA_CAPTURE_EXPLICIT_P.
+ (tsubst_lambda_expr): Pass LAMBDA_CAPTURE_EXPLICIT_P to
+ prepend_one_capture.
+
2023-02-18 Jason Merrill <jason@redhat.com>
DR 2518
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index aa2c1435..b4d3e95 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -2866,28 +2866,9 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
ctx = &new_ctx;
}
- /* Shortcut trivial constructor/op=. */
- if (trivial_fn_p (fun))
- {
- tree init = NULL_TREE;
- if (call_expr_nargs (t) == 2)
- init = convert_from_reference (get_nth_callarg (t, 1));
- else if (TREE_CODE (t) == AGGR_INIT_EXPR
- && AGGR_INIT_ZERO_FIRST (t))
- init = build_zero_init (DECL_CONTEXT (fun), NULL_TREE, false);
- if (init)
- {
- tree op = get_nth_callarg (t, 0);
- if (is_dummy_object (op))
- op = ctx->object;
- else
- op = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (op)), op);
- tree set = build2 (MODIFY_EXPR, TREE_TYPE (op), op, init);
- new_ctx.call = &new_call;
- return cxx_eval_constant_expression (&new_ctx, set, lval,
- non_constant_p, overflow_p);
- }
- }
+ /* We used to shortcut trivial constructor/op= here, but nowadays
+ we can only get a trivial function here with -fno-elide-constructors. */
+ gcc_checking_assert (!trivial_fn_p (fun) || !flag_elide_constructors);
bool non_constant_args = false;
new_call.bindings
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index b1ac7d4..1a071e9 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -19870,10 +19870,11 @@ tsubst_non_call_postfix_expression (tree t, tree args,
/* Subroutine of tsubst_lambda_expr: add the FIELD/INIT capture pair to the
LAMBDA_EXPR_CAPTURE_LIST passed in LIST. Do deduction for a previously
- dependent init-capture. */
+ dependent init-capture. EXPLICIT_P is true if the original list had
+ explicit captures. */
static void
-prepend_one_capture (tree field, tree init, tree &list,
+prepend_one_capture (tree field, tree init, tree &list, bool explicit_p,
tsubst_flags_t complain)
{
if (tree auto_node = type_uses_auto (TREE_TYPE (field)))
@@ -19893,6 +19894,7 @@ prepend_one_capture (tree field, tree init, tree &list,
cp_apply_type_quals_to_decl (cp_type_quals (type), field);
}
list = tree_cons (field, init, list);
+ LAMBDA_CAPTURE_EXPLICIT_P (list) = explicit_p;
}
/* T is a LAMBDA_EXPR. Generate a new LAMBDA_EXPR for the current
@@ -19982,12 +19984,13 @@ tsubst_lambda_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
prepend_one_capture (TREE_VEC_ELT (field, i),
TREE_VEC_ELT (init, i),
LAMBDA_EXPR_CAPTURE_LIST (r),
+ LAMBDA_CAPTURE_EXPLICIT_P (cap),
complain);
}
else
{
prepend_one_capture (field, init, LAMBDA_EXPR_CAPTURE_LIST (r),
- complain);
+ LAMBDA_CAPTURE_EXPLICIT_P (cap), complain);
if (id_equal (DECL_NAME (field), "__this"))
LAMBDA_EXPR_THIS_CAPTURE (r) = field;
diff --git a/gcc/rust/ChangeLog b/gcc/rust/ChangeLog
index 6c6d7f9..0f4aad5 100644
--- a/gcc/rust/ChangeLog
+++ b/gcc/rust/ChangeLog
@@ -1,3 +1,7 @@
+2023-02-20 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * backend/rust-tree.cc: Include memmodel.h.
+
2023-02-17 Thomas Schwinge <thomas@codesourcery.com>
* backend/rust-tree.cc: '#include "tm_p.h"'.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fcef7d8..f4f7ec2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,31 @@
+2023-02-20 Jakub Jelinek <jakub2redhat.com>
+
+ PR target/108862
+ * gcc.dg/pr108862.c: New test.
+ * gcc.target/powerpc/pr108862.c: New test.
+
+2023-02-20 Marek Polacek <polacek@redhat.com>
+
+ PR c++/101073
+ * g++.dg/cpp0x/constexpr-nsdmi3.C: New test.
+ * g++.dg/cpp1y/constexpr-nsdmi10.C: New test.
+
+2023-02-20 Marek Polacek <polacek@redhat.com>
+
+ PR c++/108829
+ * g++.dg/cpp0x/lambda/lambda-108829-2.C: New test.
+ * g++.dg/cpp0x/lambda/lambda-108829.C: New test.
+
+2023-02-20 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/108816
+ * gcc.dg/torture/pr108816.c: New testcase.
+
+2023-02-20 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/108825
+ * gcc.dg/torture/pr108825.c: New testcase.
+
2023-02-18 Jason Merrill <jason@redhat.com>
DR 2518
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-nsdmi3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-nsdmi3.C
new file mode 100644
index 0000000..ec1c4e5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-nsdmi3.C
@@ -0,0 +1,17 @@
+// PR c++/101073
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-fno-elide-constructors" }
+
+struct Y
+{
+ int a;
+};
+
+struct X
+{
+ Y b = Y{1};
+ Y c = this->b;
+};
+
+constexpr X o = { };
+static_assert(o.b.a == 1 && o.c.a == 1, "");
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-108829-2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-108829-2.C
new file mode 100644
index 0000000..4e24470
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-108829-2.C
@@ -0,0 +1,11 @@
+// PR c++/108829
+// { dg-do compile { target c++11 } }
+
+template<int, class... Ts>
+void f(Ts... ts) {
+ constexpr int IDX_PAGE_SIZE = 4096;
+ int abyPage = [=, ts...] { return IDX_PAGE_SIZE; }(); // { dg-error "redundant" }
+}
+void h() {
+ f<1>(0, 1);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-108829.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-108829.C
new file mode 100644
index 0000000..e621a0d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-108829.C
@@ -0,0 +1,11 @@
+// PR c++/108829
+// { dg-do compile { target c++11 } }
+
+template <int>
+void f(void) {
+ constexpr int IDX_PAGE_SIZE = 4096;
+ int abyPage = [=, abyPage] { return IDX_PAGE_SIZE; }(); // { dg-error "redundant" }
+}
+void h() {
+ f<1>();
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-nsdmi10.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-nsdmi10.C
new file mode 100644
index 0000000..35cb8ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-nsdmi10.C
@@ -0,0 +1,18 @@
+// PR c++/101073
+// { dg-do compile { target c++14 } }
+// { dg-additional-options "-fno-elide-constructors" }
+// A copy of constexpr-nsdmi9.C.
+
+struct Y
+{
+ int a;
+};
+
+struct X
+{
+ Y b = (c={5});
+ Y c = (b={1});
+};
+
+constexpr X o = { };
+static_assert(o.b.a == 1 && o.c.a == 1, "");
diff --git a/gcc/testsuite/gcc.dg/pr108691.c b/gcc/testsuite/gcc.dg/pr108691.c
deleted file mode 100644
index e412df1..0000000
--- a/gcc/testsuite/gcc.dg/pr108691.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O2" } */
-
-extern int __attribute__((returns_twice)) setjmp(void*);
-
-void bbb(void) {
- int (*fnptr)(void*) = setjmp;
- fnptr(0);
-}
diff --git a/gcc/testsuite/gcc.dg/pr108855.c b/gcc/testsuite/gcc.dg/pr108855.c
new file mode 100644
index 0000000..f79638f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr108855.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+int m;
+
+int
+undefined (int);
+
+__attribute__ ((pure, returns_twice)) int
+bar (void)
+{
+ m = 1;
+ while (m)
+ m = 2;
+
+ return m;
+}
+
+int
+foo (void)
+{
+ return undefined (bar ());
+}
diff --git a/gcc/testsuite/gcc.dg/pr108862.c b/gcc/testsuite/gcc.dg/pr108862.c
new file mode 100644
index 0000000..065099e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr108862.c
@@ -0,0 +1,27 @@
+/* PR target/108862 */
+/* { dg-do run { target int128 } } */
+/* { dg-options "-O2" } */
+
+unsigned long long a[2] = { 0x04a13945d898c296ULL, 0x0000100000000fffULL };
+unsigned long long b[4] = { 0x04a13945d898c296ULL, 0, 0, 0x0000100000000fffULL };
+
+__attribute__((noipa)) unsigned __int128
+foo (int x, unsigned long long *y, unsigned long long *z)
+{
+ unsigned __int128 w = 0;
+ for (int i = 0; i < x; i++)
+ w += (unsigned __int128)*y++ * (unsigned __int128)*z--;
+ return w;
+}
+
+int
+main ()
+{
+ unsigned __int128 x = foo (1, &a[0], &a[1]);
+ unsigned __int128 y = foo (2, &b[0], &b[3]);
+ if ((unsigned long long) (x >> 64) != 0x0000004a13945dd3ULL
+ || (unsigned long long) x != 0x9b1c8443b3909d6aULL
+ || x != y)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr108868.c b/gcc/testsuite/gcc.dg/pr108868.c
new file mode 100644
index 0000000..b6f1a79
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr108868.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int x;
+int vfork (void) __attribute__((__leaf__, __returns_twice__));
+int fork (void);
+void bar (int, int, int *);
+
+void
+foo (void)
+{
+ int b = 0;
+ int r = x ? vfork () : fork ();
+ bar (r, x, &b);
+}
+
+/* { dg-final { scan-tree-dump "ABNORMAL_DISPATCHER" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/torture/pr108816.c b/gcc/testsuite/gcc.dg/torture/pr108816.c
new file mode 100644
index 0000000..4c24d55
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr108816.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fvect-cost-model=dynamic" } */
+
+int m;
+
+void
+foo (int p[][16], unsigned int x)
+{
+ while (x < 4)
+ {
+ int j;
+
+ for (j = x * 4; j < (x + 1) * 4 - 2; j++)
+ p[0][j] = p[m][j];
+
+ ++x;
+ }
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr108862.c b/gcc/testsuite/gcc.target/powerpc/pr108862.c
new file mode 100644
index 0000000..89bbb08
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr108862.c
@@ -0,0 +1,6 @@
+/* PR target/108862 */
+/* { dg-do run { target int128 } } */
+/* { dg-require-effective-target p9vector_hw } */
+/* { dg-options "-O2 -mdejagnu-cpu=power9" } */
+
+#include "../../gcc.dg/pr108862.c"
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index e23293e..a9fcc7f 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -2280,9 +2280,7 @@ notice_special_calls (gcall *call)
if (flags & ECF_MAY_BE_ALLOCA)
cfun->calls_alloca = true;
- if (flags & ECF_RETURNS_TWICE
- && (!(cfun->curr_properties & PROP_cfg)
- || gimple_call_ctrl_altering_p (call)))
+ if (flags & ECF_RETURNS_TWICE)
cfun->calls_setjmp = true;
}
diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index c04fcf4..6aa3d2e 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -3477,7 +3477,7 @@ vect_loop_versioning (loop_vec_info loop_vinfo,
tree cost_name = NULL_TREE;
profile_probability prob2 = profile_probability::uninitialized ();
if (cond_expr
- && !integer_truep (cond_expr)
+ && EXPR_P (cond_expr)
&& (version_niter
|| version_align
|| version_alias
@@ -3711,6 +3711,7 @@ vect_loop_versioning (loop_vec_info loop_vinfo,
if (cost_name && TREE_CODE (cost_name) == SSA_NAME)
{
gimple *def = SSA_NAME_DEF_STMT (cost_name);
+ gcc_assert (gimple_bb (def) == condition_bb);
/* All uses of the cost check are 'true' after the check we
are going to insert. */
replace_uses_by (cost_name, boolean_true_node);