aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog138
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/ada/ChangeLog4
-rw-r--r--gcc/calls.cc3
-rw-r--r--gcc/config/avr/avr.cc19
-rw-r--r--gcc/config/i386/i386.cc22
-rw-r--r--gcc/m2/gm2-compiler/M2Students.def2
-rw-r--r--gcc/m2/gm2-compiler/M2Students.mod16
-rw-r--r--gcc/m2/gm2-compiler/P2SymBuild.mod2
-rw-r--r--gcc/m2/gm2-libs-iso/LowLong.mod10
-rw-r--r--gcc/m2/gm2-libs-iso/LowReal.mod14
-rw-r--r--gcc/m2/gm2-libs-iso/LowShort.mod14
-rw-r--r--gcc/m2/gm2-libs-iso/Processes.mod8
-rw-r--r--gcc/m2/gm2-libs-iso/RndFile.mod10
-rw-r--r--gcc/m2/gm2-libs/SCmdArgs.mod36
-rw-r--r--gcc/output.h6
-rw-r--r--gcc/testsuite/ChangeLog39
-rw-r--r--gcc/testsuite/c-c++-common/pr121159.c17
-rw-r--r--gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr116906-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/pr116906-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/pr78185.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr121236-1.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/cswtch-7.c48
-rw-r--r--gcc/testsuite/gcc.target/i386/pr121208-1a.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr121208-1b.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr121208-2a.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pr121208-2b.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr121208-3a.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pr121208-3b.c4
-rw-r--r--gcc/testsuite/gm2/warnings/style/fail/badvarname.mod14
-rw-r--r--gcc/testsuite/gm2/warnings/style/fail/warnings-style-fail.exp44
-rw-r--r--gcc/tree-if-conv.cc60
-rw-r--r--gcc/tree-switch-conversion.cc11
-rw-r--r--gcc/tree-vect-data-refs.cc2
-rw-r--r--gcc/tree-vect-stmts.cc93
-rw-r--r--gcc/tree-vectorizer.h3
-rw-r--r--gcc/varasm.cc50
-rw-r--r--gcc/vec.h4
39 files changed, 621 insertions, 156 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1672582..332776e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,141 @@
+2025-07-28 Georg-Johann Lay <avr@gjlay.de>
+
+ PR target/121277
+ * config/avr/avr.cc (avr_addr_space_convert): When converting
+ from generic AS to __flashx, don't set bit 23.
+ (avr_convert_to_type): Don't -Waddr-space-convert when NULL
+ is converted to __flashx or to __flash.
+
+2025-07-28 Andrew Pinski <quic_apinski@quicinc.com>
+
+ PR tree-optimization/121236
+ * tree-if-conv.cc (is_cond_scalar_reduction): Instead of phi argument,
+ pass bb and res of the phi.
+ (factor_out_operators): Add iterator for the phi. Remove the phi
+ if this is the first time. Return if we had removed the phi.
+ (predicate_scalar_phi): Add the phi iterator argument.
+ Update call to is_cond_scalar_reduction.
+ Update call to factor_out_operators and set the return value to true
+ when factor_out_operators returns true.
+ (predicate_all_scalar_phis): Don't remove the phi if predicate_scalar_phi
+ already removed it.
+
+2025-07-28 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/121208
+ * config/i386/i386.cc (ix86_tls_get_addr): Issue an error for
+ -mtls-dialect=gnu with no_caller_saved_registers attribute and
+ suggest -mtls-dialect=gnu2.
+
+2025-07-28 Mikael Pettersson <mikpelinux@gmail.com>
+
+ PR other/121260
+ * diagnostics/changes.cc: Correct nesting of namespaces
+ and #if CHECKING_P blocks.
+ * diagnostics/context.cc: Likewise.
+ * diagnostics/html-sink.cc: Likewise.
+ * diagnostics/output-spec.cc: Likewise.
+ * diagnostics/sarif-sink.cc: Likewise.
+
+2025-07-28 Tobias Burnus <tburnus@baylibre.com>
+
+ * config/nvptx/nvptx.opt (march-map=): Add sm_100{,f,a},
+ sm_101{,f,a}, sm_103{,a,f}, sm_120{,a,f} and sm_121{,f,a}.
+
+2025-07-28 Tobias Burnus <tburnus@baylibre.com>
+
+ * config/gcn/gcn.md (atomic_load, atomic_store, atomic_exchange):
+ Fix CDNA3 L2 cache write-back before atomic instructions.
+
+2025-07-28 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-stmts.cc (check_load_store_for_partial_vectors):
+ Make *gs_info const.
+ (vect_build_one_gather_load_call): Likewise.
+ (vect_build_one_scatter_store_call): Likewise.
+ (vect_get_gather_scatter_ops): Likewise.
+ (vect_get_strided_load_store_ops): Likewise.
+
+2025-07-28 Tobias Burnus <tburnus@baylibre.com>
+
+ * config/gcn/gcn.md (define_attr "vcmp"): Add with values
+ vcmp/vcmpx/no.
+ (*movbi, cstoredi4.., cstore<mode>4): Set it.
+ * config/gcn/gcn-valu.md (vec_cmp<mode>...): Likewise.
+ * config/gcn/gcn.cc (gcn_cmpx_insn_p): Remove.
+ (gcn_md_reorg): Add two new conditions for MI300.
+
+2025-07-28 Tobias Burnus <tburnus@baylibre.com>
+
+ * config/gcn/gcn-opts.h (enum hsaco_attr_type): Add comment
+ about 'sc0'.
+ * config/gcn/gcn.cc (gcn_md_reorg): Use gen_nops instead of gen_nop.
+ (print_operand_address): Document 'R' and 'V' in the
+ pre-function comment as well.
+ * config/gcn/gcn.md (nops): Add.
+
+2025-07-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/121256
+ * tree-vect-loop.cc (vectorizable_recurr): Build a correct
+ initialization vector for SLP_TREE_LANES > 1.
+
+2025-07-28 Richard Biener <rguenther@suse.de>
+
+ * tree-vectorizer.h (_slp_tree::type): Add.
+ (_slp_tree::u): Likewise.
+ (_stmt_vec_info::type): Remove.
+ (STMT_VINFO_TYPE): Likewise.
+ (SLP_TREE_TYPE): New.
+ * tree-vectorizer.cc (vec_info::new_stmt_vec_info): Do not
+ initialize type.
+ * tree-vect-slp.cc (_slp_tree::_slp_tree): Initialize type.
+ (vect_slp_analyze_node_operations): Adjust.
+ (vect_schedule_slp_node): Likewise.
+ * tree-vect-patterns.cc (vect_init_pattern_stmt): Do not
+ copy STMT_VINFO_TYPE.
+ * tree-vect-loop.cc: Set SLP_TREE_TYPE instead of
+ STMT_VINFO_TYPE everywhere.
+ (vect_create_loop_vinfo): Do not set STMT_VINFO_TYPE on
+ loop conditions.
+ * tree-vect-stmts.cc: Set SLP_TREE_TYPE instead of
+ STMT_VINFO_TYPE everywhere.
+ (vect_analyze_stmt): Adjust.
+ (vect_transform_stmt): Likewise.
+ * config/aarch64/aarch64.cc (aarch64_vector_costs::count_ops):
+ Access SLP_TREE_TYPE instead of STMT_VINFO_TYPE.
+ * config/i386/i386.cc (ix86_vector_costs::add_stmt_cost):
+ Remove non-SLP element-wise load/store matching.
+ * config/rs6000/rs6000.cc
+ (rs6000_cost_data::update_target_cost_per_stmt): Pass in
+ the SLP node. Use that to get at the memory access
+ kind and type.
+ (rs6000_cost_data::add_stmt_cost): Pass down SLP node.
+ * config/riscv/riscv-vector-costs.cc (variable_vectorized_p):
+ Use SLP_TREE_TYPE.
+ (costs::need_additional_vector_vars_p): Likewise.
+ (costs::update_local_live_ranges): Likewise.
+
+2025-07-28 Jennifer Schmitz <jschmitz@nvidia.com>
+ Dhruv Chawla <dhruvc@nvidia.com>
+
+ * config/aarch64/aarch64-cores.def (olympus): Use olympus tuning
+ model.
+ * config/aarch64/aarch64.cc: Include olympus.h.
+ * config/aarch64/tuning_models/olympus.h: New file.
+
+2025-07-28 Lulu Cheng <chenglulu@loongson.cn>
+
+ * config/loongarch/loongarch.h
+ (CASE_VECTOR_SHORTEN_MODE): Delete.
+
+2025-07-28 Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
+
+ * config/xtensa/xtensa.cc (xtensa_is_insn_L32R_p):
+ Re-rewrite to more accurately capture insns that could be L32R machine
+ instructions wherever possible, and add comments that help understand
+ the intent of the process.
+
2025-07-27 Pan Li <pan2.li@intel.com>
* config/riscv/riscv-v.cc (expand_vx_binary_vxrm_vec_vec_dup):
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 8ad65ad..5d7eb78 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250728
+20250729
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 6f6a782..821e3c0 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,7 @@
+2025-07-28 Marc Poulhiès <poulhies@adacore.com>
+
+ * gcc-interface/trans.cc (gnat_to_gnu): Fix typo in comment.
+
2025-07-25 David Malcolm <dmalcolm@redhat.com>
* gcc-interface/misc.cc: Make
diff --git a/gcc/calls.cc b/gcc/calls.cc
index e16190c..2711c4e 100644
--- a/gcc/calls.cc
+++ b/gcc/calls.cc
@@ -2589,7 +2589,8 @@ can_implement_as_sibling_call_p (tree exp,
return false;
}
- if (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (addr))))
+ if (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (addr)))
+ && !CALL_EXPR_MUST_TAIL_CALL (exp))
{
maybe_complain_about_tail_call (exp, _("volatile function type"));
return false;
diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc
index c469297..9468446 100644
--- a/gcc/config/avr/avr.cc
+++ b/gcc/config/avr/avr.cc
@@ -14984,10 +14984,11 @@ avr_addr_space_convert (rtx src, tree type_old, tree type_new)
/* Linearize memory: RAM has bit 23 set. When as_new = __flashx then
this is basically UB since __flashx mistreats RAM addresses, but there
- is no way to bail out. (Though -Waddr-space-convert will tell.) */
+ is no way to bail out. (Though -Waddr-space-convert will tell.)
+ ...but PR121277 is confusing, in particular when NULL is coming in. */
int msb = ADDR_SPACE_GENERIC_P (as_old)
- ? 0x80
+ ? as_new == ADDR_SPACE_MEMX ? 0x80 : 0x00
: avr_addrspace[as_old].segment;
src = force_reg (Pmode, src);
@@ -15085,10 +15086,16 @@ avr_convert_to_type (tree type, tree expr)
const char *name_old = avr_addrspace[as_old].name;
const char *name_new = avr_addrspace[as_new].name;
- warning (OPT_Waddr_space_convert,
- "conversion from address space %qs to address space %qs",
- ADDR_SPACE_GENERIC_P (as_old) ? "generic" : name_old,
- ADDR_SPACE_GENERIC_P (as_new) ? "generic" : name_new);
+ // Be relaxed when NULL is used, and when 0x0 stands for
+ // address 0x0.
+ bool nowarn = (expr == null_pointer_node
+ && (as_new == ADDR_SPACE_FLASHX
+ || as_new == ADDR_SPACE_FLASH));
+ if (!nowarn)
+ warning (OPT_Waddr_space_convert,
+ "conversion from address space %qs to address space %qs",
+ ADDR_SPACE_GENERIC_P (as_old) ? "generic" : name_old,
+ ADDR_SPACE_GENERIC_P (as_new) ? "generic" : name_new);
return fold_build1_loc (loc, ADDR_SPACE_CONVERT_EXPR, type, expr);
}
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 590cdf1..0f0acae 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -12442,6 +12442,28 @@ static GTY(()) rtx ix86_tls_symbol;
static rtx
ix86_tls_get_addr (void)
{
+ if (cfun->machine->call_saved_registers
+ == TYPE_NO_CALLER_SAVED_REGISTERS)
+ {
+ /* __tls_get_addr doesn't preserve vector registers. When a
+ function with no_caller_saved_registers attribute calls
+ __tls_get_addr, YMM and ZMM registers will be clobbered.
+ Issue an error and suggest -mtls-dialect=gnu2 in this case. */
+ if (cfun->machine->func_type == TYPE_NORMAL)
+ error (G_("%<-mtls-dialect=gnu2%> must be used with a function"
+ " with the %<no_caller_saved_registers%> attribute"));
+ else
+ error (cfun->machine->func_type == TYPE_EXCEPTION
+ ? G_("%<-mtls-dialect=gnu2%> must be used with an"
+ " exception service routine")
+ : G_("%<-mtls-dialect=gnu2%> must be used with an"
+ " interrupt service routine"));
+ /* Don't issue the same error twice. */
+ cfun->machine->func_type = TYPE_NORMAL;
+ cfun->machine->call_saved_registers
+ = TYPE_DEFAULT_CALL_SAVED_REGISTERS;
+ }
+
if (!ix86_tls_symbol)
{
const char *sym
diff --git a/gcc/m2/gm2-compiler/M2Students.def b/gcc/m2/gm2-compiler/M2Students.def
index 7d67a0a..a3ecdcd 100644
--- a/gcc/m2/gm2-compiler/M2Students.def
+++ b/gcc/m2/gm2-compiler/M2Students.def
@@ -39,7 +39,7 @@ EXPORT QUALIFIED StudentVariableCheck, CheckVariableAgainstKeyword ;
as a keyword except for its case.
*)
-PROCEDURE CheckVariableAgainstKeyword (name: Name) ;
+PROCEDURE CheckVariableAgainstKeyword (tok: CARDINAL; name: Name) ;
(*
diff --git a/gcc/m2/gm2-compiler/M2Students.mod b/gcc/m2/gm2-compiler/M2Students.mod
index e539eb0..3df160a 100644
--- a/gcc/m2/gm2-compiler/M2Students.mod
+++ b/gcc/m2/gm2-compiler/M2Students.mod
@@ -25,7 +25,7 @@ IMPLEMENTATION MODULE M2Students ;
FROM SymbolTable IMPORT FinalSymbol, IsVar, IsProcedure, IsModule,
GetMainModule, IsType, NulSym, IsRecord, GetSymName, GetNth, GetNthProcedure, GetDeclaredMod, NoOfParam ;
FROM NameKey IMPORT GetKey, WriteKey, MakeKey, IsSameExcludingCase, NulName, makekey, KeyToCharStar ;
-FROM M2MetaError IMPORT MetaErrorString0, MetaError2 ;
+FROM M2MetaError IMPORT MetaErrorStringT0, MetaError2 ;
FROM Lists IMPORT List, InitList, IsItemInList, IncludeItemIntoList ;
FROM M2Reserved IMPORT IsReserved, toktype ;
FROM DynamicStrings IMPORT String, InitString, KillString, ToUpper, InitStringCharStar, string, Mark, ToUpper, Dup ;
@@ -78,11 +78,11 @@ END IsNotADuplicateName ;
as a keyword except for its case.
*)
-PROCEDURE CheckVariableAgainstKeyword (name: Name) ;
+PROCEDURE CheckVariableAgainstKeyword (tok: CARDINAL; name: Name) ;
BEGIN
IF StyleChecking
THEN
- PerformVariableKeywordCheck (name)
+ PerformVariableKeywordCheck (tok, name)
END
END CheckVariableAgainstKeyword ;
@@ -91,7 +91,7 @@ END CheckVariableAgainstKeyword ;
PerformVariableKeywordCheck - performs the check and constructs the metaerror notes if appropriate.
*)
-PROCEDURE PerformVariableKeywordCheck (name: Name) ;
+PROCEDURE PerformVariableKeywordCheck (tok: CARDINAL; name: Name) ;
VAR
upper : Name ;
token : toktype ;
@@ -105,9 +105,11 @@ BEGIN
THEN
IF IsNotADuplicateName (name)
THEN
- MetaErrorString0 (Sprintf2 (Mark (InitString ('either the identifier has the same name as a keyword or alternatively a keyword has the wrong case ({%%K%s} and {!%%O:{%%K%s}})')),
- upperS, orig)) ;
- MetaErrorString0 (Sprintf1 (Mark (InitString ('the symbol name {!%%O:{%%K%s}} is legal as an identifier, however as such it might cause confusion and is considered bad programming practice')), orig))
+ MetaErrorStringT0 (tok,
+ Sprintf2 (Mark (InitString ('either the identifier has the same name as a keyword or alternatively a keyword has the wrong case ({%%K%s} and {!%%O:{%%K%s}})')),
+ upperS, orig)) ;
+ MetaErrorStringT0 (tok,
+ Sprintf1 (Mark (InitString ('the symbol name {!%%O:{%%K%s}} is legal as an identifier, however as such it might cause confusion and is considered bad programming practice')), orig))
END
END ;
upperS := KillString (upperS) ;
diff --git a/gcc/m2/gm2-compiler/P2SymBuild.mod b/gcc/m2/gm2-compiler/P2SymBuild.mod
index 3bb3e47..54e624f 100644
--- a/gcc/m2/gm2-compiler/P2SymBuild.mod
+++ b/gcc/m2/gm2-compiler/P2SymBuild.mod
@@ -1179,8 +1179,8 @@ BEGIN
PopT (n) ;
i := 1 ;
WHILE i <= n DO
- CheckVariableAgainstKeyword (OperandT (n+1-i)) ;
tok := OperandTok (n+1-i) ;
+ CheckVariableAgainstKeyword (tok, OperandT (n+1-i)) ;
Var := MakeVar (tok, OperandT (n+1-i)) ;
AtAddress := OperandA (n+1-i) ;
IF AtAddress # NulSym
diff --git a/gcc/m2/gm2-libs-iso/LowLong.mod b/gcc/m2/gm2-libs-iso/LowLong.mod
index 92c7d91..f611923 100644
--- a/gcc/m2/gm2-libs-iso/LowLong.mod
+++ b/gcc/m2/gm2-libs-iso/LowLong.mod
@@ -182,7 +182,7 @@ BEGIN
IF n<0
THEN
(* exception raised *)
- RAISE(except, ORD(badparam),
+ RAISE(exceptSrc, ORD(badparam),
'LowLong.trunc: cannot truncate to a negative number of digits') ;
RETURN x
ELSE
@@ -230,7 +230,7 @@ BEGIN
IF n<0
THEN
(* exception raised *)
- RAISE(except, ORD(badparam),
+ RAISE(exceptSrc, ORD(badparam),
'LowLong.round: cannot round to a negative number of digits') ;
RETURN x
ELSE
@@ -287,12 +287,12 @@ END currentMode ;
PROCEDURE IsLowException () : BOOLEAN ;
BEGIN
- RETURN( IsExceptionalExecution() AND IsCurrentSource(except) )
+ RETURN( IsExceptionalExecution () AND IsCurrentSource (exceptSrc) )
END IsLowException ;
VAR
- except: ExceptionSource ;
+ exceptSrc: ExceptionSource ;
BEGIN
- AllocateSource(except)
+ AllocateSource (exceptSrc)
END LowLong.
diff --git a/gcc/m2/gm2-libs-iso/LowReal.mod b/gcc/m2/gm2-libs-iso/LowReal.mod
index 580f36b..6d9ea00 100644
--- a/gcc/m2/gm2-libs-iso/LowReal.mod
+++ b/gcc/m2/gm2-libs-iso/LowReal.mod
@@ -183,8 +183,8 @@ BEGIN
IF n<0
THEN
(* exception raised *)
- RAISE(except, ORD(badparam),
- 'LowReal.trunc: cannot truncate to a negative number of digits') ;
+ RAISE (exceptSrc, ORD(badparam),
+ 'LowReal.trunc: cannot truncate to a negative number of digits') ;
RETURN x
ELSE
r := dtoa(x, maxsignificant, 100, point, sign) ;
@@ -231,8 +231,8 @@ BEGIN
IF n<0
THEN
(* exception raised *)
- RAISE(except, ORD(badparam),
- 'LowReal.round: cannot round to a negative number of digits') ;
+ RAISE (exceptSrc, ORD(badparam),
+ 'LowReal.round: cannot round to a negative number of digits') ;
RETURN x
ELSE
s := RealToFloatString(x, n) ;
@@ -288,12 +288,12 @@ END currentMode ;
PROCEDURE IsLowException () : BOOLEAN ;
BEGIN
- RETURN( IsExceptionalExecution() AND IsCurrentSource(except) )
+ RETURN( IsExceptionalExecution () AND IsCurrentSource (exceptSrc) )
END IsLowException ;
VAR
- except: ExceptionSource ;
+ exceptSrc: ExceptionSource ;
BEGIN
- AllocateSource(except)
+ AllocateSource (exceptSrc)
END LowReal.
diff --git a/gcc/m2/gm2-libs-iso/LowShort.mod b/gcc/m2/gm2-libs-iso/LowShort.mod
index 8531a88..62e4887 100644
--- a/gcc/m2/gm2-libs-iso/LowShort.mod
+++ b/gcc/m2/gm2-libs-iso/LowShort.mod
@@ -183,8 +183,8 @@ BEGIN
IF n<0
THEN
(* exception raised *)
- RAISE(except, ORD(badparam),
- 'LowLong.trunc: cannot truncate to a negative number of digits') ;
+ RAISE (exceptSrc, ORD(badparam),
+ 'LowLong.trunc: cannot truncate to a negative number of digits') ;
RETURN x
ELSE
r := dtoa(x, maxsignificant, 100, point, sign) ;
@@ -231,8 +231,8 @@ BEGIN
IF n<0
THEN
(* exception raised *)
- RAISE(except, ORD(badparam),
- 'LowLong.round: cannot round to a negative number of digits') ;
+ RAISE (exceptSrc, ORD(badparam),
+ 'LowLong.round: cannot round to a negative number of digits') ;
RETURN x
ELSE
s := RealToFloatString(x, n) ;
@@ -288,12 +288,12 @@ END currentMode ;
PROCEDURE IsLowException () : BOOLEAN ;
BEGIN
- RETURN( IsExceptionalExecution() AND IsCurrentSource(except) )
+ RETURN( IsExceptionalExecution () AND IsCurrentSource (exceptSrc) )
END IsLowException ;
VAR
- except: ExceptionSource ;
+ exceptSrc: ExceptionSource ;
BEGIN
- AllocateSource(except)
+ AllocateSource (exceptSrc)
END LowShort.
diff --git a/gcc/m2/gm2-libs-iso/Processes.mod b/gcc/m2/gm2-libs-iso/Processes.mod
index 8ef22c0..b0c1b69 100644
--- a/gcc/m2/gm2-libs-iso/Processes.mod
+++ b/gcc/m2/gm2-libs-iso/Processes.mod
@@ -441,7 +441,7 @@ PROCEDURE Wait ;
VAR
calling,
best : ProcessId ;
- from : COROUTINE ;
+ fromCor: COROUTINE ;
BEGIN
IF debugging
THEN
@@ -451,17 +451,17 @@ BEGIN
OnWaitingQueue (calling) ;
best := chooseProcess () ;
currentId := best ;
- from := calling^.context ;
+ fromCor := calling^.context ;
IF debugging
THEN
displayProcesses ("Wait about to perform IOTRANSFER")
END ;
- IOTRANSFER (from, currentId^.context) ;
+ IOTRANSFER (fromCor, currentId^.context) ;
IF debugging
THEN
displayProcesses ("Wait after IOTRANSFER")
END ;
- currentId^.context := from ;
+ currentId^.context := fromCor ;
currentId := calling ;
OnReadyQueue (calling) ;
IF debugging
diff --git a/gcc/m2/gm2-libs-iso/RndFile.mod b/gcc/m2/gm2-libs-iso/RndFile.mod
index e04cd8f..0a2264a 100644
--- a/gcc/m2/gm2-libs-iso/RndFile.mod
+++ b/gcc/m2/gm2-libs-iso/RndFile.mod
@@ -398,9 +398,9 @@ PROCEDURE EndPos (cid: ChanId): FilePos;
position after which there have been no writes.
*)
VAR
- d : DeviceTablePtr ;
- end,
- old: FilePos ;
+ d : DeviceTablePtr ;
+ endP,
+ old : FilePos ;
BEGIN
IF IsRndFile(cid)
THEN
@@ -410,9 +410,9 @@ BEGIN
old := CurrentPos(cid) ;
FIO.SetPositionFromEnd(RTio.GetFile(cid), 0) ;
checkErrno(dev, d) ;
- end := CurrentPos(cid) ;
+ endP := CurrentPos(cid) ;
FIO.SetPositionFromBeginning(RTio.GetFile(cid), old) ;
- RETURN( end )
+ RETURN( endP )
END
ELSE
RAISEdevException(cid, did, IOChan.wrongDevice,
diff --git a/gcc/m2/gm2-libs/SCmdArgs.mod b/gcc/m2/gm2-libs/SCmdArgs.mod
index ed76fc4..8443d5f 100644
--- a/gcc/m2/gm2-libs/SCmdArgs.mod
+++ b/gcc/m2/gm2-libs/SCmdArgs.mod
@@ -132,26 +132,27 @@ PROCEDURE GetArg (CmdLine: String;
VAR
i : CARDINAL ;
sn,
- start, end: INTEGER ;
+ startPos,
+ endPos : INTEGER ;
ch : CHAR ;
BEGIN
i := 0 ;
- start := 0 ;
- end := Length(CmdLine) ;
+ startPos := 0 ;
+ endPos := Length(CmdLine) ;
WHILE i<n DO
- start := skipWhite(CmdLine, start, end) ;
- sn := skipNextArg(CmdLine, start, end) ;
- IF sn<end
+ startPos := skipWhite(CmdLine, startPos, endPos) ;
+ sn := skipNextArg(CmdLine, startPos, endPos) ;
+ IF sn<endPos
THEN
- start := sn ;
+ startPos := sn ;
INC(i)
ELSE
RETURN( FALSE )
END
END ;
- start := skipWhite(CmdLine, start, end) ;
- sn := skipNextArg(CmdLine, start, end) ;
- Argi := Slice(CmdLine, start, sn) ;
+ startPos := skipWhite(CmdLine, startPos, endPos) ;
+ sn := skipNextArg(CmdLine, startPos, endPos) ;
+ Argi := Slice(CmdLine, startPos, sn) ;
RETURN( TRUE )
END GetArg ;
@@ -165,17 +166,18 @@ PROCEDURE Narg (CmdLine: String) : CARDINAL ;
VAR
n : CARDINAL ;
s,
- start, end: INTEGER ;
+ startPos,
+ endPos : INTEGER ;
BEGIN
n := 0 ;
- start := 0 ;
- end := Length(CmdLine) ;
+ startPos := 0 ;
+ endPos := Length(CmdLine) ;
LOOP
- start := skipWhite(CmdLine, start, end) ;
- s := skipNextArg(CmdLine, start, end) ;
- IF s<end
+ startPos := skipWhite(CmdLine, startPos, endPos) ;
+ s := skipNextArg(CmdLine, startPos, endPos) ;
+ IF s<endPos
THEN
- start := s ;
+ startPos := s ;
INC(n)
ELSE
RETURN( n )
diff --git a/gcc/output.h b/gcc/output.h
index 0c329ff..51c2d36 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -545,6 +545,9 @@ extern GTY(()) section *bss_noswitch_section;
extern GTY(()) section *in_section;
extern GTY(()) bool in_cold_section_p;
+/* MAX bit alignment for mergable sections. */
+#define MAX_ALIGN_MERGABLE 256
+
extern section *get_unnamed_section (unsigned int, void (*) (const char *),
const char *);
extern section *get_section (const char *, unsigned int, tree,
@@ -557,6 +560,9 @@ extern rtx get_section_anchor (struct object_block *, HOST_WIDE_INT,
extern section *mergeable_constant_section (machine_mode,
unsigned HOST_WIDE_INT,
unsigned int);
+extern section *mergeable_constant_section (unsigned HOST_WIDE_INT,
+ unsigned HOST_WIDE_INT,
+ unsigned int);
extern section *function_section (tree);
extern section *unlikely_text_section (void);
extern section *current_function_section (void);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6d62009..bd12ca6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,42 @@
+2025-07-28 Andrew Pinski <quic_apinski@quicinc.com>
+
+ PR tree-optimization/121236
+ * gcc.dg/torture/pr121236-1.c: New test.
+
+2025-07-28 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/121208
+ * gcc.target/i386/pr121208-1a.c: New test.
+ * gcc.target/i386/pr121208-1b.c: Likewise.
+ * gcc.target/i386/pr121208-2a.c: Likewise.
+ * gcc.target/i386/pr121208-2b.c: Likewise.
+ * gcc.target/i386/pr121208-3a.c: Likewise.
+ * gcc.target/i386/pr121208-3b.c: Likewise.
+
+2025-07-28 Thomas Schwinge <tschwinge@baylibre.com>
+
+ * gcc.target/nvptx/march-map=sm_100.c: New.
+ * gcc.target/nvptx/march-map=sm_100a.c: Likewise.
+ * gcc.target/nvptx/march-map=sm_100f.c: Likewise.
+ * gcc.target/nvptx/march-map=sm_101.c: Likewise.
+ * gcc.target/nvptx/march-map=sm_101a.c: Likewise.
+ * gcc.target/nvptx/march-map=sm_101f.c: Likewise.
+ * gcc.target/nvptx/march-map=sm_103.c: Likewise.
+ * gcc.target/nvptx/march-map=sm_103a.c: Likewise.
+ * gcc.target/nvptx/march-map=sm_103f.c: Likewise.
+ * gcc.target/nvptx/march-map=sm_120.c: Likewise.
+ * gcc.target/nvptx/march-map=sm_120a.c: Likewise.
+ * gcc.target/nvptx/march-map=sm_120f.c: Likewise.
+ * gcc.target/nvptx/march-map=sm_121.c: Likewise.
+ * gcc.target/nvptx/march-map=sm_121a.c: Likewise.
+ * gcc.target/nvptx/march-map=sm_121f.c: Likewise.
+
+2025-07-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/121256
+ * gcc.dg/vect/vect-recurr-pr121256.c: New testcase.
+ * gcc.dg/vect/vect-recurr-pr121256-2.c: Likewise.
+
2025-07-27 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/121185
diff --git a/gcc/testsuite/c-c++-common/pr121159.c b/gcc/testsuite/c-c++-common/pr121159.c
new file mode 100644
index 0000000..c8c5d67
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr121159.c
@@ -0,0 +1,17 @@
+/* PR middle-end/121159 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "foo \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
+
+[[noreturn, gnu::noipa]] void
+foo (void)
+{
+ for (;;)
+ ;
+}
+
+void
+bar (void)
+{
+ [[gnu::musttail]] return foo ();
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c b/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c
index d51d15c..6f65f4a 100644
--- a/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c
+++ b/gcc/testsuite/gcc.dg/plugin/must-tail-call-2.c
@@ -55,5 +55,5 @@ volatile fn_ptr_t fn_ptr;
void
test_5 (void)
{
- fn_ptr (); /* { dg-error "cannot tail-call: " } */
+ fn_ptr ();
}
diff --git a/gcc/testsuite/gcc.dg/pr116906-1.c b/gcc/testsuite/gcc.dg/pr116906-1.c
index 7187507..ee60ad6 100644
--- a/gcc/testsuite/gcc.dg/pr116906-1.c
+++ b/gcc/testsuite/gcc.dg/pr116906-1.c
@@ -1,3 +1,4 @@
+/* { dg-do run } */
/* { dg-require-effective-target alarm } */
/* { dg-require-effective-target signal } */
/* { dg-options "-O2" } */
diff --git a/gcc/testsuite/gcc.dg/pr116906-2.c b/gcc/testsuite/gcc.dg/pr116906-2.c
index 41a352b..4172ec3 100644
--- a/gcc/testsuite/gcc.dg/pr116906-2.c
+++ b/gcc/testsuite/gcc.dg/pr116906-2.c
@@ -1,3 +1,4 @@
+/* { dg-do run } */
/* { dg-require-effective-target alarm } */
/* { dg-require-effective-target signal } */
/* { dg-options "-O2 -fno-tree-ch" } */
diff --git a/gcc/testsuite/gcc.dg/pr78185.c b/gcc/testsuite/gcc.dg/pr78185.c
index ada8b1b..4c3af4f 100644
--- a/gcc/testsuite/gcc.dg/pr78185.c
+++ b/gcc/testsuite/gcc.dg/pr78185.c
@@ -1,3 +1,4 @@
+/* { dg-do run } */
/* { dg-require-effective-target alarm } */
/* { dg-require-effective-target signal } */
/* { dg-options "-O" } */
diff --git a/gcc/testsuite/gcc.dg/torture/pr121236-1.c b/gcc/testsuite/gcc.dg/torture/pr121236-1.c
new file mode 100644
index 0000000..2b397e3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr121236-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* PR tree-optimization/121236 */
+
+
+unsigned func_26(short *p_27, int gg, int p) {
+ unsigned l_184 = 0;
+ unsigned m = 0;
+ for (int g_59 = 0; g_59 < 10; g_59++)
+ {
+ if (gg)
+ l_184--;
+ else
+ {
+ m |= l_184 |= p;
+ (l_184)--;
+ }
+ }
+ return m;
+}
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cswtch-7.c b/gcc/testsuite/gcc.dg/tree-ssa/cswtch-7.c
new file mode 100644
index 0000000..7b797807
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cswtch-7.c
@@ -0,0 +1,48 @@
+/* PR tree-optimization/120523 */
+/* PR tree-optimization/120451 */
+/* { dg-do compile { target elf } } */
+/* { dg-options "-O2" } */
+
+void foo (int, int);
+
+__attribute__((noinline, noclone)) void
+f1 (int v, int w)
+{
+ int i, j;
+ if (w)
+ {
+ i = 129;
+ j = i - 1;
+ goto lab;
+ }
+ switch (v)
+ {
+ case 170:
+ j = 7;
+ i = 27;
+ break;
+ case 171:
+ i = 8;
+ j = 122;
+ break;
+ case 172:
+ i = 21;
+ j = -19;
+ break;
+ case 173:
+ i = 18;
+ j = 17;
+ break;
+ case 174:
+ i = 33;
+ j = 55;
+ break;
+ default:
+ __builtin_abort ();
+ }
+
+ lab:
+ foo (i, j);
+}
+
+/* { dg-final { scan-assembler ".rodata.cst32" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr121208-1a.c b/gcc/testsuite/gcc.target/i386/pr121208-1a.c
new file mode 100644
index 0000000..ac851cb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr121208-1a.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fPIC -mtls-dialect=gnu" } */
+
+extern __thread int bar;
+extern void func (void);
+
+__attribute__((no_caller_saved_registers))
+void
+foo (int error)
+{
+ bar = 1; /* { dg-error -mtls-dialect=gnu2 } */
+ if (error == 0)
+ func ();
+ bar = 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr121208-1b.c b/gcc/testsuite/gcc.target/i386/pr121208-1b.c
new file mode 100644
index 0000000..b97ac71
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr121208-1b.c
@@ -0,0 +1,4 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fPIC -mtls-dialect=gnu2" } */
+
+#include "pr121208-1a.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr121208-2a.c b/gcc/testsuite/gcc.target/i386/pr121208-2a.c
new file mode 100644
index 0000000..c1891ae
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr121208-2a.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fPIC -mtls-dialect=gnu" } */
+
+typedef unsigned int uword_t __attribute__ ((mode (__word__)));
+extern __thread int bar;
+extern void func (void);
+
+__attribute__((target("general-regs-only")))
+__attribute__((interrupt))
+void
+foo (void *frame, uword_t error)
+{
+ bar = 1; /* { dg-error -mtls-dialect=gnu2 } */
+ if (error == 0)
+ func ();
+ bar = 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr121208-2b.c b/gcc/testsuite/gcc.target/i386/pr121208-2b.c
new file mode 100644
index 0000000..269b120
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr121208-2b.c
@@ -0,0 +1,4 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fPIC -mtls-dialect=gnu2" } */
+
+#include "pr121208-2a.c"
diff --git a/gcc/testsuite/gcc.target/i386/pr121208-3a.c b/gcc/testsuite/gcc.target/i386/pr121208-3a.c
new file mode 100644
index 0000000..26fe687
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr121208-3a.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fPIC -mtls-dialect=gnu" } */
+
+typedef unsigned int uword_t __attribute__ ((mode (__word__)));
+extern __thread int bar;
+extern void func (void);
+
+__attribute__((target("general-regs-only")))
+__attribute__((interrupt))
+void
+foo (void *frame)
+{
+ bar = 1; /* { dg-error -mtls-dialect=gnu2 } */
+ if (frame == 0)
+ func ();
+ bar = 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr121208-3b.c b/gcc/testsuite/gcc.target/i386/pr121208-3b.c
new file mode 100644
index 0000000..b672d75
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr121208-3b.c
@@ -0,0 +1,4 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fPIC -mtls-dialect=gnu2" } */
+
+#include "pr121208-3a.c"
diff --git a/gcc/testsuite/gm2/warnings/style/fail/badvarname.mod b/gcc/testsuite/gm2/warnings/style/fail/badvarname.mod
new file mode 100644
index 0000000..e589b0d
--- /dev/null
+++ b/gcc/testsuite/gm2/warnings/style/fail/badvarname.mod
@@ -0,0 +1,14 @@
+MODULE badvarname ;
+
+
+PROCEDURE Foo ;
+VAR
+ end: CARDINAL ;
+BEGIN
+ end := 1
+END Foo ;
+
+
+BEGIN
+ Foo
+END badvarname.
diff --git a/gcc/testsuite/gm2/warnings/style/fail/warnings-style-fail.exp b/gcc/testsuite/gm2/warnings/style/fail/warnings-style-fail.exp
new file mode 100644
index 0000000..f44ed80
--- /dev/null
+++ b/gcc/testsuite/gm2/warnings/style/fail/warnings-style-fail.exp
@@ -0,0 +1,44 @@
+# Expect driver script for GCC Regression Tests
+# Copyright (C) 2025 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# This file was written by Gaius Mulley (gaius.mulley@southwales.ac.uk)
+# for GNU Modula-2.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# load support procs
+load_lib gm2-torture.exp
+
+gm2_init_pim "${srcdir}/gm2/warnings/style/fail"
+
+global TORTURE_OPTIONS
+
+set old_options $TORTURE_OPTIONS
+set TORTURE_OPTIONS { { -O0 -g -Werror=style } }
+
+foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $testcase] then {
+ continue
+ }
+
+ gm2-torture-fail $testcase
+}
+
+set TORTURE_OPTIONS $old_options
diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index ba25c19..a8b800b 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -1755,7 +1755,7 @@ strip_nop_cond_scalar_reduction (bool has_nop, tree op)
EXTENDED is true if PHI has > 2 arguments. */
static bool
-is_cond_scalar_reduction (gimple *phi, gimple **reduc, tree arg_0, tree arg_1,
+is_cond_scalar_reduction (basic_block bb, tree phi_res, gimple **reduc, tree arg_0, tree arg_1,
tree *op0, tree *op1, bool extended, bool* has_nop,
gimple **nop_reduc)
{
@@ -1763,7 +1763,6 @@ is_cond_scalar_reduction (gimple *phi, gimple **reduc, tree arg_0, tree arg_1,
gimple *stmt;
gimple *header_phi = NULL;
enum tree_code reduction_op;
- basic_block bb = gimple_bb (phi);
class loop *loop = bb->loop_father;
edge latch_e = loop_latch_edge (loop);
imm_use_iterator imm_iter;
@@ -1791,7 +1790,7 @@ is_cond_scalar_reduction (gimple *phi, gimple **reduc, tree arg_0, tree arg_1,
if (gimple_bb (header_phi) != loop->header)
return false;
- if (PHI_ARG_DEF_FROM_EDGE (header_phi, latch_e) != PHI_RESULT (phi))
+ if (PHI_ARG_DEF_FROM_EDGE (header_phi, latch_e) != phi_res)
return false;
if (gimple_code (stmt) != GIMPLE_ASSIGN
@@ -1889,7 +1888,7 @@ is_cond_scalar_reduction (gimple *phi, gimple **reduc, tree arg_0, tree arg_1,
continue;
if (use_stmt == SSA_NAME_DEF_STMT (r_op1))
continue;
- if (use_stmt != phi)
+ if (use_stmt != SSA_NAME_DEF_STMT (phi_res))
return false;
}
}
@@ -2199,8 +2198,8 @@ commutative:
and *RES to the new values if the factoring happened.
Loops until all of the factoring is completed. */
-static void
-factor_out_operators (tree *res, gimple_stmt_iterator *gsi,
+static bool
+factor_out_operators (gimple_stmt_iterator *pgsi, tree *res, gimple_stmt_iterator *gsi,
tree *arg0, tree *arg1, gphi *phi)
{
gimple_match_op arg0_op, arg1_op;
@@ -2208,28 +2207,28 @@ factor_out_operators (tree *res, gimple_stmt_iterator *gsi,
again:
if (TREE_CODE (*arg0) != SSA_NAME || TREE_CODE (*arg1) != SSA_NAME)
- return;
+ return repeated;
if (operand_equal_p (*arg0, *arg1))
- return;
+ return repeated;
/* If either args have > 1 use, then this transformation actually
increases the number of expressions evaluated at runtime. */
if (repeated
? (!has_zero_uses (*arg0) || !has_zero_uses (*arg1))
: (!has_single_use (*arg0) || !has_single_use (*arg1)))
- return;
+ return repeated;
gimple *arg0_def_stmt = SSA_NAME_DEF_STMT (*arg0);
if (!gimple_extract_op (arg0_def_stmt, &arg0_op))
- return;
+ return repeated;
/* At this point there should be no ssa names occuring in abnormals. */
gcc_assert (!arg0_op.operands_occurs_in_abnormal_phi ());
gimple *arg1_def_stmt = SSA_NAME_DEF_STMT (*arg1);
if (!gimple_extract_op (arg1_def_stmt, &arg1_op))
- return;
+ return repeated;
/* At this point there should be no ssa names occuring in abnormals. */
gcc_assert (!arg1_op.operands_occurs_in_abnormal_phi ());
@@ -2238,15 +2237,15 @@ again:
or the number operands. */
if (arg1_op.code != arg0_op.code
|| arg1_op.num_ops != arg0_op.num_ops)
- return;
+ return repeated;
tree new_arg0, new_arg1;
int opnum = find_different_opnum (arg0_op, arg1_op, &new_arg0, &new_arg1);
if (opnum == -1)
- return;
+ return repeated;
if (!types_compatible_p (TREE_TYPE (new_arg0), TREE_TYPE (new_arg1)))
- return;
+ return repeated;
tree new_res = make_ssa_name (TREE_TYPE (new_arg0), NULL);
/* Create the operation stmt if possible and insert it. */
@@ -2262,7 +2261,7 @@ again:
if (!result)
{
release_ssa_name (new_res);
- return;
+ return repeated;
}
gsi_insert_seq_before (gsi, seq, GSI_CONTINUE_LINKING);
@@ -2277,6 +2276,10 @@ again:
fprintf (dump_file, ".\n");
}
+ /* Remove the phi and move to the next phi arg if needed. */
+ if (!repeated)
+ remove_phi_node (pgsi, false);
+
/* Remove the old operation(s) that has single use. */
gimple_stmt_iterator gsi_for_def;
@@ -2400,8 +2403,9 @@ cmp_arg_entry (const void *p1, const void *p2, void * /* data. */)
vectorization. */
-static void
-predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi, bool loop_versioned)
+static bool
+predicate_scalar_phi (gimple_stmt_iterator *phi_gsi, gphi *phi,
+ gimple_stmt_iterator *gsi, bool loop_versioned)
{
gimple *new_stmt = NULL, *reduc, *nop_reduc;
tree rhs, res, arg0, arg1, op0, op1, scev;
@@ -2411,10 +2415,11 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi, bool loop_versioned)
basic_block bb;
unsigned int i;
bool has_nop;
+ bool removed_phi = false;
res = gimple_phi_result (phi);
if (virtual_operand_p (res))
- return;
+ return removed_phi;
if ((rhs = degenerate_phi_result (phi))
|| ((scev = analyze_scalar_evolution (gimple_bb (phi)->loop_father,
@@ -2431,7 +2436,7 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi, bool loop_versioned)
new_stmt = gimple_build_assign (res, rhs);
gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT);
update_stmt (new_stmt);
- return;
+ return removed_phi;
}
bb = gimple_bb (phi);
@@ -2477,9 +2482,13 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi, bool loop_versioned)
/* Factor out operand if possible. This can only be done easily
for PHI with 2 elements. */
- factor_out_operators (&res, gsi, &arg0, &arg1, phi);
+ if (factor_out_operators (phi_gsi, &res, gsi, &arg0, &arg1, phi))
+ {
+ phi = nullptr;
+ removed_phi = true;
+ }
- if (is_cond_scalar_reduction (phi, &reduc, arg0, arg1,
+ if (is_cond_scalar_reduction (bb, res, &reduc, arg0, arg1,
&op0, &op1, false, &has_nop,
&nop_reduc))
{
@@ -2508,7 +2517,7 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi, bool loop_versioned)
fprintf (dump_file, "new phi replacement stmt\n");
print_gimple_stmt (dump_file, new_stmt, 0, TDF_SLIM);
}
- return;
+ return removed_phi;
}
/* Create hashmap for PHI node which contain vector of argument indexes
@@ -2576,7 +2585,7 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi, bool loop_versioned)
/* Gimplify the condition to a valid cond-expr conditonal operand. */
cond = force_gimple_operand_gsi (gsi, unshare_expr (cond), true,
NULL_TREE, true, GSI_SAME_STMT);
- if (!(is_cond_scalar_reduction (phi, &reduc, arg0 , arg1,
+ if (!(is_cond_scalar_reduction (bb, res, &reduc, arg0 , arg1,
&op0, &op1, true, &has_nop, &nop_reduc)))
rhs = fold_build_cond_expr (TREE_TYPE (res), unshare_expr (cond),
swap ? arg1 : arg0,
@@ -2606,6 +2615,7 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi, bool loop_versioned)
fprintf (dump_file, "new extended phi replacement stmt\n");
print_gimple_stmt (dump_file, new_stmt, 0, TDF_SLIM);
}
+ return removed_phi;
}
/* Replaces in LOOP all the scalar phi nodes other than those in the
@@ -2642,8 +2652,8 @@ predicate_all_scalar_phis (class loop *loop, bool loop_versioned)
gsi_next (&phi_gsi);
else
{
- predicate_scalar_phi (phi, &gsi, loop_versioned);
- remove_phi_node (&phi_gsi, false);
+ if (!predicate_scalar_phi (&phi_gsi, phi, &gsi, loop_versioned))
+ remove_phi_node (&phi_gsi, false);
}
}
}
diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc
index d088287..04b357f 100644
--- a/gcc/tree-switch-conversion.cc
+++ b/gcc/tree-switch-conversion.cc
@@ -55,6 +55,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "hwint.h"
#include "internal-fn.h"
#include "diagnostic-core.h"
+#include "output.h"
/* ??? For lang_hooks.types.type_for_mode, but is there a word_mode
type in the GIMPLE type system that is language-independent? */
@@ -1033,6 +1034,16 @@ switch_conversion::build_one_array (int num, tree arr_index_type,
/* The decl is mergable since we don't take the address ever and
just reading from it. */
DECL_MERGEABLE (decl) = 1;
+
+ /* Increase the alignments as needed. */
+ if (tree_to_uhwi (DECL_SIZE (decl)) > DECL_ALIGN (decl))
+ {
+ unsigned HOST_WIDE_INT s = tree_to_uhwi (DECL_SIZE (decl));
+ /* Only support up to the max supported for merging. */
+ if (s <= MAX_ALIGN_MERGABLE)
+ SET_DECL_ALIGN (decl, HOST_WIDE_INT_1U << ceil_log2 (s));
+ }
+
if (offloading_function_p (cfun->decl))
DECL_ATTRIBUTES (decl)
= tree_cons (get_identifier ("omp declare target"), NULL_TREE,
diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc
index 3bf2852..e7919b7 100644
--- a/gcc/tree-vect-data-refs.cc
+++ b/gcc/tree-vect-data-refs.cc
@@ -4542,7 +4542,6 @@ vect_describe_gather_scatter_call (stmt_vec_info stmt_info,
(call, internal_fn_alias_ptr_index (info->ifn));
info->offset = gimple_call_arg
(call, internal_fn_offset_index (info->ifn));
- info->offset_dt = vect_unknown_def_type;
info->offset_vectype = NULL_TREE;
info->scale = TREE_INT_CST_LOW (gimple_call_arg
(call, internal_fn_scale_index (info->ifn)));
@@ -4872,7 +4871,6 @@ vect_check_gather_scatter (stmt_vec_info stmt_info, loop_vec_info loop_vinfo,
get_object_alignment (DR_REF (dr)));
info->offset = off;
- info->offset_dt = vect_unknown_def_type;
info->offset_vectype = offset_vectype;
info->scale = scale;
info->element_type = TREE_TYPE (vectype);
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 9edc4a8..4cf6c3b 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -1676,7 +1676,6 @@ vect_truncate_gather_scatter_offset (stmt_vec_info stmt_info, tree vectype,
get_object_alignment (DR_REF (dr)));
gs_info->element_type = TREE_TYPE (vectype);
gs_info->offset = fold_convert (offset_type, step);
- gs_info->offset_dt = vect_constant_def;
gs_info->scale = scale;
gs_info->memory_type = memory_type;
return true;
@@ -2229,22 +2228,23 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info,
*memory_access_type = VMAT_GATHER_SCATTER;
else if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
{
- tree offset;
- slp_tree offset_node;
*memory_access_type = VMAT_GATHER_SCATTER;
if (!vect_check_gather_scatter (stmt_info, loop_vinfo, gs_info,
elsvals))
gcc_unreachable ();
+ slp_tree offset_node = SLP_TREE_CHILDREN (slp_node)[0];
+ tree offset_vectype = SLP_TREE_VECTYPE (offset_node);
+ gs_info->offset_vectype = offset_vectype;
/* When using internal functions, we rely on pattern recognition
to convert the type of the offset to the type that the target
requires, with the result being a call to an internal function.
If that failed for some reason (e.g. because another pattern
took priority), just handle cases in which the offset already
has the right type. */
- else if (GATHER_SCATTER_IFN_P (*gs_info)
- && !is_gimple_call (stmt_info->stmt)
- && !tree_nop_conversion_p (TREE_TYPE (gs_info->offset),
- TREE_TYPE (gs_info->offset_vectype)))
+ if (GATHER_SCATTER_IFN_P (*gs_info)
+ && !is_gimple_call (stmt_info->stmt)
+ && !tree_nop_conversion_p (TREE_TYPE (gs_info->offset),
+ offset_vectype))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -2252,23 +2252,12 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info,
vls_type == VLS_LOAD ? "gather" : "scatter");
return false;
}
- else if (!vect_is_simple_use (vinfo, slp_node, 0, &offset, &offset_node,
- &gs_info->offset_dt,
- &gs_info->offset_vectype))
- {
- if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "%s index use not simple.\n",
- vls_type == VLS_LOAD ? "gather" : "scatter");
- return false;
- }
else if (GATHER_SCATTER_EMULATED_P (*gs_info))
{
if (!TYPE_VECTOR_SUBPARTS (vectype).is_constant ()
- || !TYPE_VECTOR_SUBPARTS (gs_info->offset_vectype).is_constant ()
- || VECTOR_BOOLEAN_TYPE_P (gs_info->offset_vectype)
- || !constant_multiple_p (TYPE_VECTOR_SUBPARTS
- (gs_info->offset_vectype),
+ || !TYPE_VECTOR_SUBPARTS (offset_vectype).is_constant ()
+ || VECTOR_BOOLEAN_TYPE_P (offset_vectype)
+ || !constant_multiple_p (TYPE_VECTOR_SUBPARTS (offset_vectype),
TYPE_VECTOR_SUBPARTS (vectype)))
{
if (dump_enabled_p ())
@@ -10211,29 +10200,6 @@ vectorizable_load (vec_info *vinfo,
tree bump;
tree vec_offset = NULL_TREE;
- if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
- {
- aggr_type = NULL_TREE;
- bump = NULL_TREE;
- }
- else if (memory_access_type == VMAT_GATHER_SCATTER)
- {
- aggr_type = elem_type;
- if (!costing_p)
- vect_get_strided_load_store_ops (stmt_info, vectype, loop_vinfo,
- gsi, &gs_info,
- &bump, &vec_offset, loop_lens);
- }
- else
- {
- if (memory_access_type == VMAT_LOAD_STORE_LANES)
- aggr_type = build_array_type_nelts (elem_type, group_size * nunits);
- else
- aggr_type = vectype;
- if (!costing_p)
- bump = vect_get_data_ptr_increment (vinfo, gsi, dr_info, aggr_type,
- memory_access_type, loop_lens);
- }
auto_vec<tree> vec_offsets;
auto_vec<tree> vec_masks;
@@ -10248,6 +10214,11 @@ vectorizable_load (vec_info *vinfo,
gcc_assert (alignment_support_scheme == dr_aligned
|| alignment_support_scheme == dr_unaligned_supported);
+ aggr_type = build_array_type_nelts (elem_type, group_size * nunits);
+ if (!costing_p)
+ bump = vect_get_data_ptr_increment (vinfo, gsi, dr_info, aggr_type,
+ memory_access_type, loop_lens);
+
unsigned int inside_cost = 0, prologue_cost = 0;
/* For costing some adjacent vector loads, we'd like to cost with
the total number of them once instead of cost each one by one. */
@@ -10409,20 +10380,31 @@ vectorizable_load (vec_info *vinfo,
{
gcc_assert (!grouped_load && !slp_perm);
- unsigned int inside_cost = 0, prologue_cost = 0;
-
/* 1. Create the vector or array pointer update chain. */
- if (!costing_p)
+ if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
{
- if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
+ aggr_type = NULL_TREE;
+ bump = NULL_TREE;
+ if (!costing_p)
vect_get_gather_scatter_ops (loop, slp_node, &gs_info, &dataref_ptr,
&vec_offsets);
- else
- dataref_ptr
- = vect_create_data_ref_ptr (vinfo, first_stmt_info, aggr_type,
- at_loop, offset, &dummy, gsi,
- &ptr_incr, false, bump);
}
+ else
+ {
+ aggr_type = elem_type;
+ if (!costing_p)
+ {
+ vect_get_strided_load_store_ops (stmt_info, vectype, loop_vinfo,
+ gsi, &gs_info,
+ &bump, &vec_offset, loop_lens);
+ dataref_ptr
+ = vect_create_data_ref_ptr (vinfo, first_stmt_info, aggr_type,
+ at_loop, offset, &dummy, gsi,
+ &ptr_incr, false, bump);
+ }
+ }
+
+ unsigned int inside_cost = 0, prologue_cost = 0;
gimple *new_stmt = NULL;
for (i = 0; i < vec_num; i++)
@@ -10744,6 +10726,11 @@ vectorizable_load (vec_info *vinfo,
return true;
}
+ aggr_type = vectype;
+ if (!costing_p)
+ bump = vect_get_data_ptr_increment (vinfo, gsi, dr_info, aggr_type,
+ memory_access_type, loop_lens);
+
poly_uint64 group_elt = 0;
unsigned int inside_cost = 0, prologue_cost = 0;
/* For costing some adjacent vector loads, we'd like to cost with
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 4a1e4fc..203e5ad 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -1561,9 +1561,6 @@ struct gather_scatter_info {
being added to the base. */
int scale;
- /* The definition type for the vectorized offset. */
- enum vect_def_type offset_dt;
-
/* The type of the vectorized offset. */
tree offset_vectype;
diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index 8266282..000ad9e 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -871,7 +871,7 @@ mergeable_string_section (tree decl ATTRIBUTE_UNUSED,
if (HAVE_GAS_SHF_MERGE && flag_merge_constants
&& TREE_CODE (decl) == STRING_CST
&& TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
- && align <= 256
+ && align <= MAX_ALIGN_MERGABLE
&& (len = int_size_in_bytes (TREE_TYPE (decl))) > 0
&& TREE_STRING_LENGTH (decl) == len)
{
@@ -885,7 +885,7 @@ mergeable_string_section (tree decl ATTRIBUTE_UNUSED,
mode = SCALAR_INT_TYPE_MODE (TREE_TYPE (TREE_TYPE (decl)));
modesize = GET_MODE_BITSIZE (mode);
- if (modesize >= 8 && modesize <= 256
+ if (modesize >= 8 && modesize <= MAX_ALIGN_MERGABLE
&& (modesize & (modesize - 1)) == 0)
{
if (align < modesize)
@@ -919,16 +919,14 @@ mergeable_string_section (tree decl ATTRIBUTE_UNUSED,
/* Return the section to use for constant merging. */
section *
-mergeable_constant_section (machine_mode mode ATTRIBUTE_UNUSED,
- unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED,
- unsigned int flags ATTRIBUTE_UNUSED)
+mergeable_constant_section (unsigned HOST_WIDE_INT size_bits,
+ unsigned HOST_WIDE_INT align,
+ unsigned int flags)
{
if (HAVE_GAS_SHF_MERGE && flag_merge_constants
- && mode != VOIDmode
- && mode != BLKmode
- && known_le (GET_MODE_BITSIZE (mode), align)
+ && size_bits <= align
&& align >= 8
- && align <= 256
+ && align <= MAX_ALIGN_MERGABLE
&& (align & (align - 1)) == 0)
{
const char *prefix = function_mergeable_rodata_prefix ();
@@ -940,6 +938,38 @@ mergeable_constant_section (machine_mode mode ATTRIBUTE_UNUSED,
}
return readonly_data_section;
}
+
+
+/* Return the section to use for constant merging. Like the above
+ but the size stored as a tree. */
+static section *
+mergeable_constant_section (tree size_bits,
+ unsigned HOST_WIDE_INT align,
+ unsigned int flags)
+{
+ if (!size_bits || !tree_fits_uhwi_p (size_bits))
+ return readonly_data_section;
+ return mergeable_constant_section (tree_to_uhwi (size_bits), align, flags);
+}
+
+
+/* Return the section to use for constant merging. Like the above
+ but given a mode rather than the size. */
+
+section *
+mergeable_constant_section (machine_mode mode,
+ unsigned HOST_WIDE_INT align,
+ unsigned int flags)
+{
+ /* If the mode is unknown (BLK or VOID), then return a non mergable section. */
+ if (mode == BLKmode || mode == VOIDmode)
+ return readonly_data_section;
+ unsigned HOST_WIDE_INT size;
+ if (!GET_MODE_BITSIZE (mode).is_constant (&size))
+ return readonly_data_section;
+ return mergeable_constant_section (size, align, flags);
+}
+
/* Given NAME, a putative register name, discard any customary prefixes. */
@@ -7453,7 +7483,7 @@ default_elf_select_section (tree decl, int reloc,
case SECCAT_RODATA_MERGE_STR_INIT:
return mergeable_string_section (DECL_INITIAL (decl), align, 0);
case SECCAT_RODATA_MERGE_CONST:
- return mergeable_constant_section (DECL_MODE (decl), align, 0);
+ return mergeable_constant_section (DECL_SIZE (decl), align, 0);
case SECCAT_SRODATA:
sname = ".sdata2";
break;
diff --git a/gcc/vec.h b/gcc/vec.h
index 9604edb..0ea7a49 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -2514,6 +2514,10 @@ public:
return false;
if (lhs.size () != rhs.size ())
return false;
+ /* Case where either is a NULL pointer and therefore, as both are valid,
+ both are empty slices with length 0. */
+ if (lhs.size () == 0)
+ return true;
return memcmp (lhs.begin (), rhs.begin (), lhs.size ()) == 0;
}