[Bug tree-optimization/69336] Constant value not detected

2016-01-29 Thread wdijkstr at arm dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

Wilco  changed:

   What|Removed |Added

 CC||wdijkstr at arm dot com

--- Comment #13 from Wilco  ---
(In reply to Richard Biener from comment #6)
> Author: rguenth
> Date: Tue Jan 19 13:27:11 2016
> New Revision: 232559
> 
> URL: https://gcc.gnu.org/viewcvs?rev=232559=gcc=rev

Even with this fix it still fails SPEC2006 gamess on AArch64 exactly as
reported in bug 69368.  It passes if I revert the EXPR_SINGLE case in
hashable_expr_equal_p to what it was before r232055 (ie. equal_mem_array_ref_p
is still not correct).

[Bug tree-optimization/69336] Constant value not detected

2016-01-29 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

--- Comment #14 from rguenther at suse dot de  ---
On January 29, 2016 8:09:02 PM GMT+01:00, wdijkstr at arm dot com
 wrote:
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336
>
>Wilco  changed:
>
>   What|Removed |Added
>
>CC||wdijkstr at arm dot com
>
>--- Comment #13 from Wilco  ---
>(In reply to Richard Biener from comment #6)
>> Author: rguenth
>> Date: Tue Jan 19 13:27:11 2016
>> New Revision: 232559
>> 
>> URL: https://gcc.gnu.org/viewcvs?rev=232559=gcc=rev
>
>Even with this fix it still fails SPEC2006 gamess on AArch64 exactly as
>reported in bug 69368.  It passes if I revert the EXPR_SINGLE case in
>hashable_expr_equal_p to what it was before r232055 (ie.
>equal_mem_array_ref_p
>is still not correct).

Can you re-open that bug please and try to track down the issue somewhat?

[Bug tree-optimization/69336] Constant value not detected

2016-01-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

--- Comment #11 from Richard Biener  ---
Should be fixed with

2016-01-25  Richard Biener  

PR testsuite/69380
* g++.dg/tree-ssa/pr69336.C: Restrict to x86_64 and i?86.

[Bug tree-optimization/69336] Constant value not detected

2016-01-27 Thread vogt at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

--- Comment #12 from Dominik Vogt  ---
The test works now on s390x.  Thanks.

[Bug tree-optimization/69336] Constant value not detected

2016-01-26 Thread vogt at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

Dominik Vogt  changed:

   What|Removed |Added

 CC||vogt at linux dot vnet.ibm.com

--- Comment #10 from Dominik Vogt  ---
The new test fails on s390x; what should I do about it?
(see https://gcc.gnu.org/ml/gcc-patches/2016-01/msg01359.html )

[Bug tree-optimization/69336] Constant value not detected

2016-01-22 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

ktkachov at gcc dot gnu.org changed:

   What|Removed |Added

 CC||ktkachov at gcc dot gnu.org

--- Comment #9 from ktkachov at gcc dot gnu.org ---
(In reply to Richard Biener from comment #6)

> 
>   * g++.dg/tree-ssa/pr69336.C: New testcase.

This testcase fails for me on arm-none-eabi.
The optimized dump on -std=c++14 -O3 -fdump-tree-optimized -std=c++14 contains:
int main() ()
{
  size_t n;
  const struct static_map cmap;
  const char * _4;
  int _5;
  int _11;
  void * _15;
  int _25;

  :
  cmap = *.LC3;
  _5 = cmap._values[0].second.first;
  if (_5 == 8)
goto ;
  else
goto ;

  :
  _25 = cmap._values[1].second.first;
  if (_25 == 8)
goto ;
  else
goto ;

  :
  _11 = cmap._values[2].second.first;
  if (_11 == 8)
goto ;
  else
goto ;

  :
  # n_8 = PHI <2(4), 0(2), 1(3)>
  _4 = MEM[(const char * const &)]._values[n_8].second.second;
  if (_4 == 0B)
goto ;
  else
goto ;

  :
  _15 = __cxa_allocate_exception (8);
  std::out_of_range::out_of_range (_15, "Key not found");

  :
  __cxa_throw (_15, &_ZTISt12out_of_range, __comp_dtor );

:
  __cxa_free_exception (_15);
  __builtin_cxa_end_cleanup ();

  :
  abort ();

  :
  cmap ={v} {CLOBBER};
  return 0;

}

[Bug tree-optimization/69336] Constant value not detected

2016-01-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

Jakub Jelinek  changed:

   What|Removed |Added

 CC||seurer at linux dot 
vnet.ibm.com

--- Comment #8 from Jakub Jelinek  ---
*** Bug 69368 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/69336] Constant value not detected

2016-01-19 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

--- Comment #6 from Richard Biener  ---
Author: rguenth
Date: Tue Jan 19 13:27:11 2016
New Revision: 232559

URL: https://gcc.gnu.org/viewcvs?rev=232559=gcc=rev
Log:
2016-01-19  Richard Biener  

PR tree-optimization/69336
* tree-ssa-scopedtables.c (avail_expr_hash): Handle all
handled components with get_ref_base_and_extent.
(equal_mem_array_ref_p): Adjust.

* g++.dg/tree-ssa/pr69336.C: New testcase.

Added:
trunk/gcc/testsuite/g++.dg/tree-ssa/pr69336.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-scopedtables.c

[Bug tree-optimization/69336] Constant value not detected

2016-01-19 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

Richard Biener  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to work||6.0
 Resolution|--- |FIXED

--- Comment #5 from Richard Biener  ---
Fixed on trunk.

[Bug tree-optimization/69336] Constant value not detected

2016-01-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

Jakub Jelinek  changed:

   What|Removed |Added

 CC||ienkovich at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek  ---
*** Bug 69358 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/69336] Constant value not detected

2016-01-18 Thread alalaw01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

alalaw01 at gcc dot gnu.org changed:

   What|Removed |Added

 CC||alalaw01 at gcc dot gnu.org

--- Comment #4 from alalaw01 at gcc dot gnu.org ---
That looks reasonable, AFAICT get_ref_base_and_extent will deal with anything
that is handled_component_p. The same patch enables the optimization on
aarch64, with appropriate --param sra-max-scalarization-size-Ospeed to pull the
constant-pool entry in.

[Bug tree-optimization/69336] Constant value not detected

2016-01-18 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

Richard Biener  changed:

   What|Removed |Added

 CC||alan.lawrence at arm dot com

--- Comment #2 from Richard Biener  ---
Yes, I think there is a duplicate (and a proposed patch).

[Bug tree-optimization/69336] Constant value not detected

2016-01-18 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

[Bug tree-optimization/69336] Constant value not detected

2016-01-18 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

--- Comment #3 from Richard Biener  ---
Not fixed with r232508.  Fixed with the suggested

Index: gcc/tree-ssa-scopedtables.c
===
--- gcc/tree-ssa-scopedtables.c (revision 232508)
+++ gcc/tree-ssa-scopedtables.c (working copy)
@@ -214,7 +214,7 @@ avail_expr_hash (class expr_hash_elt *p)
 {
   /* T could potentially be a switch index or a goto dest.  */
   tree t = expr->ops.single.rhs;
-  if (TREE_CODE (t) == MEM_REF || TREE_CODE (t) == ARRAY_REF)
+  if (TREE_CODE (t) == MEM_REF || handled_component_p (t))
{
  /* Make equivalent statements of both these kinds hash together.
 Dealing with both MEM_REF and ARRAY_REF allows us not to care
@@ -251,9 +251,9 @@ avail_expr_hash (class expr_hash_elt *p)
 static bool
 equal_mem_array_ref_p (tree t0, tree t1)
 {
-  if (TREE_CODE (t0) != MEM_REF && TREE_CODE (t0) != ARRAY_REF)
+  if (TREE_CODE (t0) != MEM_REF && ! handled_component_p (t0))
 return false;
-  if (TREE_CODE (t1) != MEM_REF && TREE_CODE (t1) != ARRAY_REF)
+  if (TREE_CODE (t1) != MEM_REF && ! handled_component_p (t1))
 return false;

   if (!types_compatible_p (TREE_TYPE (t0), TREE_TYPE (t1)))

[Bug tree-optimization/69336] Constant value not detected

2016-01-17 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69336

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-01-17
 Ever confirmed|0   |1

--- Comment #1 from Andrew Pinski  ---
There is another bug recorded somewhere about the cmap._values[1].second.second
vs MEM[(const char * const &)]._values[1].second.second issue.