Re: [PATCH] libiberty/pex-win32.c: Initialize orig_err

2020-11-08 Thread Christophe Lyon via Gcc-patches
On Sat, 7 Nov 2020 at 00:59, Jeff Law  wrote:
>
>
> On 9/18/20 6:33 AM, Christophe Lyon wrote:
> > On Thu, 17 Sep 2020 at 23:33, Jeff Law  wrote:
> >>
> >> On 9/14/20 3:29 AM, Christophe Lyon via Gcc-patches wrote:
> >>> Initializing orig_err avoids a warning: "may be used uninitialized".
> >>>
> >>> 2020-09-14  Torbjörn SVENSSON 
> >>>   Christophe Lyon  
> >>>
> >>>   libiberty/
> >>>   * pex-win32 (pex_win32_exec_child): Initialize orig_err.
> >> Rather than just blindly initializing orig_err, we'd actually prefer to
> >> have a compilable testcase and analyze why we're getting the warning.  A
> >> false positive -Wuninitialized warning is often a missed optimization
> >> under the hood.
> >>
> > OK, I filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97108
> > after checking the problem is still present with trunk and not only
> > with the old gcc version we have in our builders.
>
> Thanks.  I've put an initial analysis in there.  I think it's pointing
> at a failing in both the traditional threader as well as the backwards
> threader.  The backwards threader is probably the place to fix it in the
> long term.
>
>
> In the immediate term, go ahead with the trivial initialization so that
> it doesn't show up in your builds.  We'll track the threader issue via
> the BZ.
>

Thanks, pushed as r11-4828.

>
> Thanks,
>
> jeff
>


Re: [24/32] module mapper

2020-11-08 Thread Boris Kolpackov
I've noticed the following issues with the module mapper in the
-fdirectives-only mode:


1. When partially preprocessing the module interface unit, the mapper
   receives the MODULE-EXPORT request that's unnecessary (BMI is not
   written):

   g++ ... -x c++ -E -fdirectives-only -o hello.gcm.ii hello.mxx

   Similarly, in this mode, the mapper receives MODULE-IMPORT for
   (non-header) module imports. Again, this is not necessary and
   replying with a non-existent BMI works.


2. When doing full preprocessing of a partially preprocessed unit,
   the mapper again receives MODULE-EXPORT and MODULE-IMPORT for
   non-header modules:

   g++-m ... -E -x c++ -fpreprocessed -fdirectives-only hello.gcm.ii

   These are also unnecessary.


Re: [04/32] cpp lexer

2020-11-08 Thread Boris Kolpackov
Nathan Sidwell  writes:

> > This doesn't seem to match the code to go into directives mode all that 
> > well.? You don't reset pragma_allow_expansion or directive_line.
> 
> Hm, yeah.  I think neither of those fields have any bearing in 
> non-directives mode, and always get set when entering it?  Again, 
> comment at the very least.

FWIW, I remember wrestling with that login in my branch, here are the
changes to directives-only.c (in particular, see the "Handle import 
as pseudo-directive (P1703R0)" commit):

https://github.com/boris-kolpackov/gcc-cxx-modules-ex/commits/c%2B%2B-modules-ex/libcpp/directives-only.c


Eco-friendly paper bowls 20201109

2020-11-08 Thread ZEEHENG PAK via Gcc-patches
Dear:


 Zeeheng manufacture here, exporting CLEAR PLASTIC CUP/PAPER BOWL/COFFEE
CUP with good quality and low price.




Call me, let’s talk details.


Rgds,

Luke.zhang


[Patch, testsuite]: Update MicroBlaze strings test

2020-11-08 Thread Nagaraju Mekala
Hello All,

for new scan-assembly output resulting in use of $LC label

gcc/testsuite/ChangeLog:
* gcc.target/microblaze/others/strings1.c: Update
to include $LC label.

---
gcc/testsuite/ChangeLog   | 5 +
gcc/testsuite/gcc.target/microblaze/others/strings1.c | 5 +++--
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 081be8f..9ef22c8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2020-11-09  Nagaraju Mekala  

+   * gcc.target/microblaze/others/strings1.c: Update
+   to include $LC label.
+
+2020-11-09  Nagaraju Mekala  
+
* gcc.target/microblaze/long.c: New test.

2020-11-08  Iain Sandoe  
diff --git a/gcc/testsuite/gcc.target/microblaze/others/strings1.c 
b/gcc/testsuite/gcc.target/microblaze/others/strings1.c
index 7a63faf..efaf3c6 100644
--- a/gcc/testsuite/gcc.target/microblaze/others/strings1.c
+++ b/gcc/testsuite/gcc.target/microblaze/others/strings1.c
@@ -1,13 +1,14 @@
/* { dg-options "-O3" } */
+/* { dg-final { scan-assembler "\.rodata*" } } */
+/* { dg-final { scan-assembler 
"addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),\\\$LC.*"
 } } */
+/* { dg-final { scan-assembler 
"\lwi\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),*" } } 
*/

#include 

-/* { dg-final { scan-assembler "\.rodata*" } } */
extern void somefunc (char *);
int testfunc ()
{
 char string2[80];
-/* { dg-final { scan-assembler 
"\lwi\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,.LC*" } } */
 strcpy (string2, "hello");
 somefunc (string2);
}
--
1.8.3.1

Attached is the patch.

Thanks,
Nagaraju



0001-Patch-testsuite-Update-MicroBlaze-strings-test.patch
Description: 0001-Patch-testsuite-Update-MicroBlaze-strings-test.patch


[Patch, microblaze]: Correct the const high double immediate value

2020-11-08 Thread Nagaraju Mekala
Hello All,

This patch will load the DI mode immediate values from
REAL_VALUE_FROM_CONST_DOUBLE and REAL_VALUE_TO_TARGET_DOUBLE functions, as
CONST_DOUBLE_HIGH was returning the sign extension value even for the
unsigned long long constants also

gcc/ChangeLog:
* config/microblaze/microblaze.c (print_operand): Update
loading of DI mode immediate values using
REAL_VALUE_FROM_CONST_DOUBLE and
REAL_VALUE_TO_TARGET_DOUBLE

gcc/testsuite/ChangeLog:
* gcc.target/microblaze/long.c: New test.
---
gcc/ChangeLog  |  6 ++
gcc/config/microblaze/microblaze.c |  9 ++---
gcc/testsuite/ChangeLog|  4 
gcc/testsuite/gcc.target/microblaze/long.c | 10 ++
4 files changed, 27 insertions(+), 3 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/microblaze/long.c

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1a4c4f6..f28ebf7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2020-11-09 Nagaraju Mekala 
+
+   * config/microblaze/microblaze.c (print_operand): Update loading
+   of DI mode immediate values using REAL_VALUE_FROM_CONST_DOUBLE
+   and REAL_VALUE_TO_TARGET_DOUBLE
+
2020-11-08  David Edelsohn  

* config/rs6000/rs6000.c (rs6000_mangle_decl_assembler_name): Change
diff --git a/gcc/config/microblaze/microblaze.c 
b/gcc/config/microblaze/microblaze.c
index a0f81b7..d9341ec 100644
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
@@ -2440,15 +2440,18 @@ print_operand (FILE * file, rtx op, int letter)

   else if (letter == 'h' || letter == 'j')
 {
-  long val[2];
+  long val[2], l[2];
   if (code == CONST_DOUBLE)
{
  if (GET_MODE (op) == DFmode)
REAL_VALUE_TO_TARGET_DOUBLE (*CONST_DOUBLE_REAL_VALUE (op), val);
  else
{
- val[0] = CONST_DOUBLE_HIGH (op);
- val[1] = CONST_DOUBLE_LOW (op);
+ REAL_VALUE_TYPE rv;
+ REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
+ REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
+ val[1] = l[WORDS_BIG_ENDIAN == 0];
+ val[0] = l[WORDS_BIG_ENDIAN != 0];
}
}
   else if (code == CONST_INT)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index cff8ccf..081be8f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2020-11-09  Nagaraju Mekala  
+
+   * gcc.target/microblaze/long.c: New test.
+
2020-11-08  Iain Sandoe  

* obj-c++.dg/property/at-property-4.mm: Test handling class
diff --git a/gcc/testsuite/gcc.target/microblaze/long.c 
b/gcc/testsuite/gcc.target/microblaze/long.c
new file mode 100644
index 000..4d45186
--- /dev/null
+++ b/gcc/testsuite/gcc.target/microblaze/long.c
@@ -0,0 +1,10 @@
+/* { dg-options "-O0" } */
+#define BASEADDR 0xF000ULL
+int main ()
+{
+  unsigned long long start;
+  start = (unsigned long long) BASEADDR;
+  return 0;
+}
+/* { dg-final { scan-assembler 
"addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,0x" } } */
+/* { dg-final { scan-assembler 
"addik\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r0,0xf000" } } */
--
1.8.3.1

Attached is the patch.

Thanks,
Nagaraju



0001-Patch-microblaze-Correct-the-const-high-double-immed.patch
Description: 0001-Patch-microblaze-Correct-the-const-high-double-immed.patch


Re: [PATCH]ira: recompute regstat as max_regno changes [PR97705]

2020-11-08 Thread Kewen.Lin via Gcc-patches
Hi Vladimir,

on 2020/11/6 下午10:49, Vladimir Makarov wrote:
> 
> On 2020-11-06 1:15 a.m., Kewen.Lin wrote:
>> Hi,
>>
>> As PR97705 shows, my commit r11-4637 caused some dumping
>> comparison difference error on pass ira.  It exposed one
>> issue about the newly introduced function remove_scratches,
>> which can increase the largest pseudo reg number if it
>> succeeds, later some function will use the max_reg_num()
>> to get the latest max_regno, when iterating the numbers
>> we can access some data structures which are allocated as
>> the previous max_regno, some out of array bound accesses
>> can occur, the failure can be random since the values
>> beyond the array could be random.
>>
>> This patch is to free/reinit/recompute the relevant data
>> structures that is regstat_n_sets_and_refs and reg_info_p
>> to ensure we won't access beyond some array bounds.
>>
>> Bootstrapped/regtested on powerpc64le-linux-gnu P9 and
>> powerpc64-linux-gnu P8.
>>
>> Any thoughts?  Is it a reasonable fix?
>>
> Sure, Kewen.  A bit unexpected to see lambda to use for this but I checked 
> and found couple places in GCC where lambdas are already used.

Thanks for your prompt review!

Yeah, gcc11 build requires C++11 support as noted in changes.html.

> 
> The patch is ok.  Please, commit it to the mainline.

Thanks.  Committed in r11-4827.

BR,
Kewen


RE: [PATCH PR94442] [AArch64] Redundant ldp/stp instructions emitted at -O3

2020-11-08 Thread xiezhiheng
> -Original Message-
> From: Richard Sandiford [mailto:richard.sandif...@arm.com]
> Sent: Tuesday, November 3, 2020 9:57 PM
> To: xiezhiheng 
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH PR94442] [AArch64] Redundant ldp/stp instructions
> emitted at -O3
> 
> Thanks, I pushed both patches to trunk.
> 

Thanks.  And I made two separate patches for these two groups, tbl/tbx 
intrinsics and
the rest of the arithmetic operation intrinsics.

Note: It does not matter which patch is applied first.

Bootstrapped and tested on aarch64 Linux platform.

Thanks,
Xie Zhiheng


diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index eab26b5f3a9..4f81c86fc76 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-11-09  Zhiheng Xie  
+   Nannan Zheng  
+
+   * config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
+   for tbl/tbx intrinsics.
+

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index eab26b5f3a9..193fbe4cf7d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-11-09  Zhiheng Xie  
+   Nannan Zheng  
+
+   * config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
+   for arithmetic operation intrinsics.
+


arithmetic-operation-v1.patch
Description: arithmetic-operation-v1.patch


tbl_tbx-v1.patch
Description: tbl_tbx-v1.patch


[PATCH] Add a new pattern in 4-insn combine

2020-11-08 Thread HAO CHEN GUI via Gcc-patches

Hi,

This patch adds a new pattern in 4-insn combine. It supports the 
following sign_extend(op: zero_extend, zero_extend) optimization. In the 
patch, newpat is split twice. The first split becomes newi1pat and the 
second becomes newi2pat. They replace i1, i2 and i3 if all of them can 
be recognized.


7: r126:SI=zero_extend([r123:DI+0x1])
6: r125:SI=zero_extend([r123:DI])
8: r127:SI=r125:SI+r126:SI
9: r124:DI=sign_extend(r127:SI)

are replaced by:

7: r125:DI=zero_extend([r123:DI])
8: r127:DI=zero_extend([r123:DI+0x1])
9: r124:DI=r127:DI+r125:DI

The attachments are the patch diff file and change log file.

Bootstrapped and tested on powerpc64le-linux-gnu with no regressions.  
Is this okay for trunk? Any recommendations? Thanks a lot.



* combine.c (combine_validate_cost): Add an argument for newi1pat.
(try_combine): Add a 4-insn combine pattern for optimizing rtx
sign_extend (op:zero_extend, zero_extend).
diff --git a/gcc/combine.c b/gcc/combine.c
index c88382efbd3..73259e6a9ed 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -851,10 +851,11 @@ do_SUBST_LINK (struct insn_link **into, struct insn_link 
*newval)
 
 static bool
 combine_validate_cost (rtx_insn *i0, rtx_insn *i1, rtx_insn *i2, rtx_insn *i3,
-  rtx newpat, rtx newi2pat, rtx newotherpat)
+  rtx newpat, rtx newi2pat, rtx newotherpat,
+  rtx newi1pat)
 {
   int i0_cost, i1_cost, i2_cost, i3_cost;
-  int new_i2_cost, new_i3_cost;
+  int new_i1_cost, new_i2_cost, new_i3_cost;
   int old_cost, new_cost;
 
   /* Lookup the original insn_costs.  */
@@ -915,6 +916,20 @@ combine_validate_cost (rtx_insn *i0, rtx_insn *i1, 
rtx_insn *i2, rtx_insn *i3,
   new_i2_cost = 0;
 }
 
+  if (newi1pat)
+{
+   tmp = PATTERN (i1);
+   PATTERN (i1) = newi1pat;
+   tmpi = INSN_CODE (i1);
+   INSN_CODE (i1) = -1;
+   new_i1_cost = insn_cost (i1, optimize_this_for_speed_p);
+   PATTERN (i1) = tmp;
+   INSN_CODE (i1) = tmpi;
+   new_cost = new_i1_cost > 0 ? new_i1_cost + new_cost : 0;
+}
+  else
+new_i1_cost = 0;
+
   if (undobuf.other_insn)
 {
   int old_other_cost, new_other_cost;
@@ -958,7 +973,10 @@ combine_validate_cost (rtx_insn *i0, rtx_insn *i1, 
rtx_insn *i2, rtx_insn *i3,
fprintf (dump_file, "%d + ", i1_cost);
   fprintf (dump_file, "%d + %d = %d\n", i2_cost, i3_cost, old_cost);
 
-  if (newi2pat)
+  if (newi1pat)
+   fprintf (dump_file, "replacement costs %d + %d + %d = %d\n",
+new_i1_cost, new_i2_cost, new_i3_cost, new_cost);
+  else if (newi2pat)
fprintf (dump_file, "replacement costs %d + %d = %d\n",
 new_i2_cost, new_i3_cost, new_cost);
   else
@@ -973,7 +991,10 @@ combine_validate_cost (rtx_insn *i0, rtx_insn *i1, 
rtx_insn *i2, rtx_insn *i3,
   INSN_COST (i3) = new_i3_cost;
   if (i1)
 {
-  INSN_COST (i1) = 0;
+  if (newi1pat)
+   INSN_COST (i1) = new_i1_cost;
+  else
+   INSN_COST (i1) = 0;
   if (i0)
INSN_COST (i0) = 0;
 }
@@ -2672,7 +2693,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, 
rtx_insn *i0,
 int *new_direct_jump_p, rtx_insn *last_combined_insn)
 {
   /* New patterns for I3 and I2, respectively.  */
-  rtx newpat, newi2pat = 0;
+  rtx newpat, newi2pat = 0, newi1pat = 0;
   rtvec newpat_vec_with_clobbers = 0;
   int substed_i2 = 0, substed_i1 = 0, substed_i0 = 0;
   /* Indicates need to preserve SET in I0, I1 or I2 in I3 if it is not
@@ -2682,8 +2703,9 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, 
rtx_insn *i0,
   int total_sets;
   /* Nonzero if I2's or I1's body now appears in I3.  */
   int i2_is_used = 0, i1_is_used = 0;
-  /* INSN_CODEs for new I3, new I2, and user of condition code.  */
+  /* INSN_CODEs for new I3, new I2, new I1 and user of condition code.  */
   int insn_code_number, i2_code_number = 0, other_code_number = 0;
+  int i1_code_number = 0;
   /* Contains I3 if the destination of I3 is used in its source, which means
  that the old life of I3 is being killed.  If that usage is placed into
  I2 and not in I3, a REG_DEAD note must be made.  */
@@ -2756,7 +2778,9 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, 
rtx_insn *i0,
  else if (BINARY_P (src) && CONSTANT_P (XEXP (src, 1)))
ngood++;
  else if (GET_CODE (src) == ASHIFT || GET_CODE (src) == ASHIFTRT
-  || GET_CODE (src) == LSHIFTRT)
+  || GET_CODE (src) == LSHIFTRT
+  || GET_CODE (src) == SIGN_EXTEND
+  || GET_CODE (src) == ZERO_EXTEND)
nshift++;
}
 
@@ -3399,6 +3423,12 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, 
rtx_insn *i0,
  i1src = subst (i1src, pc_rtx, pc_rtx, 0, 0, 0);
}
 
+ if (i0)
+   {
+ subst_low_luid = DF_INSN_LUID (i0);
+ i0src = subst (i0src, pc_rtx, pc_rtx, 0

[PATCH] Hurd: Enable ifunc by default

2020-11-08 Thread Samuel Thibault
The binutils bugs seem to have been fixed.

2020-11-08  Samuel Thibault  

gcc/
* config.gcc: Enable default_gnu_indirect_function in *-*-gnu*
target (but not *-*-kfreebsd*-gnu | *-*-kopensolaris*-gnu).
---
 gcc/config.gcc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index b42ebc4e5be..a347c2cec7c 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3538,7 +3538,9 @@ esac
 case ${target} in
 *-*-linux*android*|*-*-linux*uclibc*|*-*-linux*musl*)
 ;;
-*-*-linux*)
+*-*-kfreebsd*-gnu | *-*-kopensolaris*-gnu)
+;;
+*-*-linux* | *-*-gnu*)
case ${target} in
aarch64*-* | arm*-* | i[34567]86-* | powerpc*-* | s390*-* | sparc*-* | 
x86_64-*)
default_gnu_indirect_function=yes
-- 
2.20.1



Improve handling of memory operands in ipa-icf 1/4

2020-11-08 Thread Jan Hubicka
Hello,
I would like to finally address the problem with ipa-icf being overly
conservating on memory operand equality and having overly weak hash
function. This leads to code size, compile time and compile time memory
use regressions sompared to earlier versions where we merged more
aggressively because of weaker TBAA.

Basically comparing memory operand should match for memory accesses that
does same base+offset computations and have same behaviour WRT TBAA.
When optimizing for size we would like to discard TBAA info in the case
of TBAA mismatch if they perform same actual load.

>From past discussion we conlcuded that operand_equal_p (in fold-const)
is not good place to address this since it is used for generic trees as
well.  The TBAA matching/hashing is best done in tree-ssa-alias since it
is inherently tied to its internals.

I would like to do following
 1) keep track what parameters are memory operands.  This is implemented
in the attached patch.
 2) Add ao_ref interface for hasing and comparing references inheriting
fold-const.h:operand_compare which then can feed ICF equivalences
adding:

int ao_ref_compare (ao_ref ref1, ao_ref ref2)

It will return mask how refs differ:

AO_REF_SEMANTICS if the actual access is different
(i.e. different base, offset or size of the access)
AO_REF_BASE_ALIAS_SET if base alias set differs.
AO_REF_ALIAS_SET if base ref set differs.
AO_REF_ACCESS_PATH if access path differs.

and 

ao_ref_hash (ao_ref hash, int flags)

which will compute hashtable where flags are same AO_REF as above.

Initial implementation can compare alias sets for !LTO and for LTO
compare TYPE_MAIN_VARIANTS.  We currently have no way to hash access
types for LTO, I plan to add that incremntally.

 3) Make ipa_icf use ao_ref_compare == 0 to do current merging and
!(ao_ref_compare & AO_REF_SEMANTICS) for size optimized code.

 4) Add way of hading alias sets for LTO.  This can be done by moving
canonical type hash out of lto that I think would be nice cleanup
anyway.  I have older patch for that (it needs to be untied from
TYPE_CANONICAL computation by adding extra hashtable but it has no
performance impact)

Other alternative is to simply collect list of types relevant and
compare them at WPA time as done by earlier Martin's patch.

Later we could play with merging TBAA mismatches memory references with
-O2+ and clearing them only for uninlined clones, but this is tricky and
can wait for next stage1.

Does this make sense?

Attached patch implements set 1.  I use walk_stmt_load_store_ops to
discover memor operands by storing them to pointer set. This has the
expense of extra hashing.  An alternative would be to embed the logic
into icf walkers, but it seems to be fast enough and I do not see
that as a good motivation to duplicate the logic into comparsion and
hashers.

I have bootstrapped/regtstested on x86_64 and would like to commit it
after some discussion tomorrow.

Honza


2020-11-08  Jan Hubicka  

* ipa-icf-gimple.c: Include gimple-walk.h.
(func_checker::compare_ssa_name): Update call of compare_operand.
(func_checker::hash_operand): Fix comment and add variant taking
operand_access_type parameter.
(func_checker::compare_operand): Add operand_access_type parameter.
(func_checker::compare_asm_inputs_outputs): Add
operand_access_type_map parameter; update use of
func_checker::compare_operand.
(func_checker::compare_gimple_call): Update use of
func_checker::compare_operand.
(func_checker::compare_gimple_assign): Likewise.
(func_checker::compare_gimple_cond): Likewise.
(func_checker::compare_gimple_switch): Likewise.
(func_checker::compare_gimple_return): Likewise.
(func_checker::compare_gimple_goto): Likewise.
(func_checker::compare_gimple_asm): Likewise.
(visit_load_store): New static functio.
(func_checker::classify_operands): New member function.
(func_checker::get_operand_access_type): New member function.
* ipa-icf-gimple.h (func_checker::operand_access_type): New enum
(func_checker::operand_access_type_map): New typedef.
(func_checker::compare_operand): Update prototype.
(func_checker::compare_asm_inputs_outputs): Likewise.
(func_checker::cleassify_operands): Declare.
(func_checker::get_operand_access_type): Declare.
(func_checker::hash_operand): New variant with operand_access_type.
* ipa-icf.c (sem_function::hash_stmt): Update uses of hash_operand.
(sem_function::compare_phi_node): Update use of compare_operand.
* tree-ssa-structalias.c (find_func_aliases_for_builtin_call):

diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index d5423a7e9b2..f75951f7c49 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -38,6 +38,7 @@ along with GCC; see the

[PATCH] 2/2 Remove debug/array

2020-11-08 Thread François Dumont via Gcc-patches
Following a recent fix on std::array this test started to fail in 
_GLIBCXX_DEBUG mode.


FAIL: 23_containers/array/comparison_operators/96851.cc (test for excess 
errors)


Rather than fixing it and now that __glibcxx_assert is constexpr 
compatible I would like to propose to simply remove __gnu_debug::array.


The only code we are losing with this change are the 
_Array_check_nonempty/_Array_check_subscript types. I am not sure about 
the purpose of this code as I saw no impact on tests. Maybe it was to 
avoid assertion in constexpr where the value of the expression is not 
use but there is a test doing that and it does produce an assertion.


Note that I am also moving std::array in versioned namespace. It is just 
for consistency so no problem to remove it.


I also manually edited include/Makefile.in cause I do not have the 
proper autoreconf version. Can you regenerate it on your side once patch 
is in ?


    libstdc++: Remove 

    Add _GLIBCXX_ASSERTIONS assert in normal std::array and remove 
__gnu_debug::array

    implementation.

    libstdc++-v3/ChangeLog:

    * include/debug/array: Remove.
    * include/Makefile.am: Remove .
    * include/Makefile.in: Regenerate.
    * include/experimental/functional: Adapt.
    * include/std/array: Move to _GLIBCXX_INLINE_VERSION namespace.
    * include/std/functional: Adapt.
    * include/std/span: Adapt.
    * testsuite/23_containers/array/debug/back1_neg.cc:
    Remove dg-require-debug-mode. Add -D_GLIBCXX_ASSERTIONS option.
    * testsuite/23_containers/array/debug/back2_neg.cc: Likewise.
    * testsuite/23_containers/array/debug/front1_neg.cc: Likewise.
    * testsuite/23_containers/array/debug/front2_neg.cc: Likewise.
    * 
testsuite/23_containers/array/debug/square_brackets_operator1_neg.cc:

    Likewise.
    * 
testsuite/23_containers/array/debug/square_brackets_operator2_neg.cc:

    Likewise.
    * testsuite/23_containers/array/element_access/60497.cc
    * 
testsuite/23_containers/array/tuple_interface/get_debug_neg.cc:

    Remove.
    * testsuite/23_containers/array/tuple_interface/get_neg.cc
    * 
testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc
    * 
testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc


Tested under Linux x86_64 normal and debug modes.

Ok to commit ?

François

diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 8652b921274..292d89da8ba 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -856,7 +856,6 @@ endif
 debug_srcdir = ${glibcxx_srcdir}/include/debug
 debug_builddir = ./debug
 debug_headers = \
-	${debug_srcdir}/array \
 	${debug_srcdir}/assertions.h \
 	${debug_srcdir}/bitset \
 	${debug_srcdir}/debug.h \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 4eb6b2b480a..fff444c69e8 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -1195,7 +1195,6 @@ c_compatibility_builddir = .
 debug_srcdir = ${glibcxx_srcdir}/include/debug
 debug_builddir = ./debug
 debug_headers = \
-	${debug_srcdir}/array \
 	${debug_srcdir}/assertions.h \
 	${debug_srcdir}/bitset \
 	${debug_srcdir}/debug.h \
diff --git a/libstdc++-v3/include/debug/array b/libstdc++-v3/include/debug/array
deleted file mode 100644
index dd4044c9c7b..000
--- a/libstdc++-v3/include/debug/array
+++ /dev/null
@@ -1,408 +0,0 @@
-// Debugging array implementation -*- C++ -*-
-
-// Copyright (C) 2012-2020 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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, or (at your option)
-// any later version.
-
-// This library 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.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-// .
-
-/** @file debug/array
- *  This is a Standard C++ Library header.
- */
-
-#ifndef _GLIBCXX_DEBUG_ARRAY
-#define _GLIBCXX_DEBUG_ARRAY 1
-
-#pragma GCC system_header
-
-#include 
-
-#include 
-#include 
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-namespace __debug
-{
-  template
-s

[PATCH] 1/2 Make _GLIBCXX_DEBUG checks constexpr compatible

2020-11-08 Thread François Dumont via Gcc-patches
Now that __glibcxx_assert is constexpr compatible we can do the same for 
the _GLIBCXX_DEBUG equivalent.


I had also try to do the same on my own so this patch contains the 
string_view tests I had written when doing so.


I plan to activate some _GLIBCXX_DEBUG checks when _GLIBCXX_ASSERTIONS 
is defined but only the contant time checks. Is it ok to run checks like 
__check_partitioned_lower in constexpr ?


    libstdc++: Make _GLIBCXX_DEBUG checks constexpr compatible

    libstdc++-v3/ChangeLog:

    * include/debug/assertions.h 
(__glibcxx_requires_non_empty_range):

    Remove __builtin_expect.
    (__glibcxx_requires_subscript): Likewise.
    (__glibcxx_requires_nonempty): Likewise.
    * include/debug/formatter.h (__check_singular): Add C++11 
constexpr

    qualification.
    * include/debug/helper_functions.h (__check_singular): 
Likewise. Skip

    check if constant evaluated.
    (__valid_range): Do not skip check if constant evaluated.
    * include/debug/macros.h (_GLIBCXX_DEBUG_VERIFY_COND_AT): Add
    __builtin_expect.
    (_GLIBCXX_DEBUG_VERIFY_AT_F): Use __glibcxx_assert_1.
    * testsuite/21_strings/basic_string_view/element_access/char/
    back_constexpr_neg.cc: New test.
    * testsuite/21_strings/basic_string_view/element_access/char/
    constexpr.cc: New test.
    * testsuite/21_strings/basic_string_view/element_access/char/
    constexpr_neg.cc: New test.
    * testsuite/21_strings/basic_string_view/element_access/char/
    front_back_constexpr.cc: New test.
    * testsuite/21_strings/basic_string_view/element_access/char/
    front_constexpr_neg.cc: New test.
    * 
testsuite/21_strings/basic_string_view/element_access/wchar_t/

    back_constexpr_neg.cc: New test.
    * 
testsuite/21_strings/basic_string_view/element_access/wchar_t/

    constexpr.cc: New test.
    * 
testsuite/21_strings/basic_string_view/element_access/wchar_t/

    constexpr_neg.cc: New test.
    * 
testsuite/21_strings/basic_string_view/element_access/wchar_t/

    front_constexpr_neg.cc: New test.
    * testsuite/25_algorithms/lower_bound/debug/
    constexpr_partitioned_neg.cc: New test.
    * testsuite/25_algorithms/lower_bound/debug/
    constexpr_partitioned_pred_neg.cc: New test.
    * testsuite/25_algorithms/lower_bound/debug/
    constexpr_valid_range_neg.cc: New test.
    * testsuite/25_algorithms/lower_bound/debug/partitioned_neg.cc:
    New test.
    * 
testsuite/25_algorithms/lower_bound/debug/partitioned_pred_neg.cc:

    New test.
    * testsuite/25_algorithms/upper_bound/debug/
    constexpr_partitioned_neg.cc: New test.
    * testsuite/25_algorithms/upper_bound/debug/
    constexpr_partitioned_pred_neg.cc: New test.
    * testsuite/25_algorithms/upper_bound/debug/
    constexpr_valid_range_neg.cc: New test.
    * testsuite/25_algorithms/upper_bound/debug/partitioned_neg.cc:
    New test.
    * 
testsuite/25_algorithms/upper_bound/debug/partitioned_pred_neg.cc:

    New test.

Tested under Linux x86_64.

Ok to commit ?

François

diff --git a/libstdc++-v3/include/debug/assertions.h b/libstdc++-v3/include/debug/assertions.h
index fb52e441424..16cf6bbe7ac 100644
--- a/libstdc++-v3/include/debug/assertions.h
+++ b/libstdc++-v3/include/debug/assertions.h
@@ -45,12 +45,12 @@
 
 // Verify that [_First, _Last) forms a non-empty iterator range.
 # define __glibcxx_requires_non_empty_range(_First,_Last)	\
-  __glibcxx_assert(__builtin_expect(_First != _Last, true))
+  __glibcxx_assert(_First != _Last)
 # define __glibcxx_requires_subscript(_N)	\
-  __glibcxx_assert(__builtin_expect(_N < this->size(), true))
+  __glibcxx_assert(_N < this->size())
 // Verify that the container is nonempty
 # define __glibcxx_requires_nonempty()		\
-  __glibcxx_assert(__builtin_expect(!this->empty(), true))
+  __glibcxx_assert(!this->empty())
 #endif
 
 #ifdef _GLIBCXX_DEBUG
diff --git a/libstdc++-v3/include/debug/formatter.h b/libstdc++-v3/include/debug/formatter.h
index c4283fe6047..8734ed06cb5 100644
--- a/libstdc++-v3/include/debug/formatter.h
+++ b/libstdc++-v3/include/debug/formatter.h
@@ -72,7 +72,8 @@ namespace __gnu_debug
   using std::type_info;
 
   template
-bool __check_singular(const _Iterator&);
+_GLIBCXX_CONSTEXPR
+bool __check_singular(_Iterator const&);
 
   class _Safe_sequence_base;
 
diff --git a/libstdc++-v3/include/debug/helper_functions.h b/libstdc++-v3/include/debug/helper_functions.h
index 62d5309257f..281e9c7390e 100644
--- a/libstdc++-v3/include/debug/helper_functions.h
+++ b/libstdc++-v3/include/debug/helper_functions.h
@@ -120,15 +120,29 @@ namespace __gnu_debug
   // We may have an itera

[pushed] Objective-C/C++ : Handle parsing @property 'class' attribute.

2020-11-08 Thread Iain Sandoe
Hi

(this change reused the existing ‘class’ keyword and RID, so only
 needed Objective-C context modifications).

tested on x86_64-darwin, x86_64-linux-gnu,
pushed to master,
thanks
Iain



This attribute states that a property is one manipulated by class
methods (it requires a static variable and the setter and getter
must be provided explicitly, they cannot be @synthesized).

gcc/c-family/ChangeLog:

* c-common.h (OBJC_IS_PATTR_KEYWORD): Add class to the list
of keywords accepted in @property attribute contexts.
* c-objc.h (enum objc_property_attribute_group): Add
OBJC_PROPATTR_GROUP_CLASS.
(enum objc_property_attribute_kind): Add
OBJC_PROPERTY_ATTR_CLASS.

gcc/cp/ChangeLog:

* parser.c (cp_parser_objc_at_property_declaration): Handle
class keywords in @property attribute context.

gcc/objc/ChangeLog:

* objc-act.c (objc_prop_attr_kind_for_rid): Handle class
attribute.
(objc_add_property_declaration): Likewise.
* objc-act.h (PROPERTY_CLASS): Record class attribute state.

gcc/testsuite/ChangeLog:

* obj-c++.dg/property/at-property-4.mm: Test handling class
attributes.
* objc.dg/property/at-property-4.m: Likewise.
---
 gcc/c-family/c-common.h   |  6 +++--
 gcc/c-family/c-objc.h |  2 ++
 gcc/cp/parser.c   |  4 +++
 gcc/objc/objc-act.c   | 10 +++
 gcc/objc/objc-act.h   |  4 +++
 .../obj-c++.dg/property/at-property-4.mm  | 27 +++
 .../objc.dg/property/at-property-4.m  | 21 +--
 7 files changed, 53 insertions(+), 21 deletions(-)

diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 7e2cd5342aa..bfcc279609c 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -275,9 +275,11 @@ enum rid
   ((unsigned int) (rid) >= (unsigned int) RID_FIRST_PQ && \
(unsigned int) (rid) <= (unsigned int) RID_LAST_PQ)
 
+/* Keywords permitted in an @property attribute context.  */
 #define OBJC_IS_PATTR_KEYWORD(rid) \
-  ((unsigned int) (rid) >= (unsigned int) RID_FIRST_PATTR && \
-   (unsigned int) (rid) <= (unsigned int) RID_LAST_PATTR)
+  unsigned int) (rid) >= (unsigned int) RID_FIRST_PATTR && \
+ (unsigned int) (rid) <= (unsigned int) RID_LAST_PATTR)) \
+   || rid == RID_CLASS)
 
 /* OBJC_IS_CXX_KEYWORD recognizes the 'CXX_OBJC' keywords (such as
'class') which are shared in a subtle way between Objective-C and
diff --git a/gcc/c-family/c-objc.h b/gcc/c-family/c-objc.h
index a2ca112dcc6..6e96731882b 100644
--- a/gcc/c-family/c-objc.h
+++ b/gcc/c-family/c-objc.h
@@ -44,6 +44,7 @@ enum objc_property_attribute_group
   OBJC_PROPATTR_GROUP_READWRITE,
   OBJC_PROPATTR_GROUP_ASSIGN,
   OBJC_PROPATTR_GROUP_ATOMIC,
+  OBJC_PROPATTR_GROUP_CLASS,
   OBJC_PROPATTR_GROUP_MAX
 };
 
@@ -59,6 +60,7 @@ enum objc_property_attribute_kind
   OBJC_PROPERTY_ATTR_COPY =( 7 << 8)|OBJC_PROPATTR_GROUP_ASSIGN,
   OBJC_PROPERTY_ATTR_ATOMIC =  ( 8 << 8)|OBJC_PROPATTR_GROUP_ATOMIC,
   OBJC_PROPERTY_ATTR_NONATOMIC =   ( 9 << 8)|OBJC_PROPATTR_GROUP_ATOMIC,
+  OBJC_PROPERTY_ATTR_CLASS =   (16 << 8)|OBJC_PROPATTR_GROUP_CLASS,
   OBJC_PROPERTY_ATTR_MAX = (255 << 8|OBJC_PROPATTR_GROUP_MAX)
 };
 
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index c4c672efa09..323d7424a83 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -34052,6 +34052,10 @@ cp_parser_objc_at_property_declaration (cp_parser 
*parser)
enum rid keyword;
if (token->type == CPP_NAME)
  keyword = C_RID_CODE (token->u.value);
+   else if (token->type == CPP_KEYWORD
+&& token->keyword == RID_CLASS)
+ /* Account for accepting the 'class' keyword in this context.  */
+ keyword = RID_CLASS;
else
  keyword = RID_MAX; /* By definition, an unknown property.  */
cp_lexer_consume_token (parser->lexer);
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 2dad46aa77e..b9ed32d51d0 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -825,6 +825,7 @@ objc_prop_attr_kind_for_rid (enum rid prop_rid)
   case RID_PROPATOMIC: return OBJC_PROPERTY_ATTR_ATOMIC;
   case RID_NONATOMIC:  return OBJC_PROPERTY_ATTR_NONATOMIC;
 
+  case RID_CLASS:  return OBJC_PROPERTY_ATTR_CLASS;
 }
 }
 
@@ -986,6 +987,14 @@ objc_add_property_declaration (location_t location, tree 
decl,
gcc_unreachable ();
 }
 
+  /* An attribute that indicates this property manipulates a class variable.
+ In this case, both the variable and the getter/setter must be provided
+ by the user.  */
+  bool property_class = false;
+  if (attrs[OBJC_PROPATTR_GROUP_CLASS])
+property_nonatomic = attrs[OBJC_PROPATTR_GROUP_CLASS]->prop_kind
+== OBJC_PROPERTY_ATTR_CLASS;

[pushed] testsuite, Darwin, X86 : Add target requires native tls to test.

2020-11-08 Thread Iain Sandoe
Hi

The builtin_thread_pointer test does not work for emulated TLS.
Add a target requires to cover this.

tested on x86_64-darwin, x86_64-linux-gnu
pushed to master,
Iain

gcc/testsuite/ChangeLog:

* gcc.target/i386/builtin_thread_pointer.c: Require native TLS.
---
 gcc/testsuite/gcc.target/i386/builtin_thread_pointer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/testsuite/gcc.target/i386/builtin_thread_pointer.c 
b/gcc/testsuite/gcc.target/i386/builtin_thread_pointer.c
index 16a7ca49b99..09b704bd5a1 100644
--- a/gcc/testsuite/gcc.target/i386/builtin_thread_pointer.c
+++ b/gcc/testsuite/gcc.target/i386/builtin_thread_pointer.c
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-require-effective-target tls_native } */
 /* { dg-options "-mtls-direct-seg-refs -O2 -masm=att" } */
 
 int*
-- 
2.24.1