[Bug tree-optimization/84013] wrong __restrict clique with inline asm operand

2018-10-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84013

--- Comment #8 from Richard Biener  ---
Author: rguenth
Date: Wed Oct 24 09:42:19 2018
New Revision: 265455

URL: https://gcc.gnu.org/viewcvs?rev=265455=gcc=rev
Log:
2018-10-24  Richard Biener  

PR tree-optimization/84013
* tree-ssa-structalias.c (struct msdi_data): New struct for
marshalling data to walk_stmt_load_store_ops.
(maybe_set_dependence_info): Refactor as callback for
walk_stmt_load_store_ops.
(compute_dependence_clique): Set restrict info on all stmt kinds.

* gcc.dg/tree-ssa/restrict-9.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/restrict-9.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-structalias.c

[Bug tree-optimization/84013] wrong __restrict clique with inline asm operand

2018-10-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84013

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #7 from Richard Biener  ---
Fixed.

[Bug tree-optimization/84013] wrong __restrict clique with inline asm operand

2018-10-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84013

--- Comment #6 from Richard Biener  ---
Created attachment 44886
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44886=edit
patch I am testing

Patch I am testing - sorry for the delay.

[Bug tree-optimization/84013] wrong __restrict clique with inline asm operand

2018-10-03 Thread katsunori.kumatani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84013

--- Comment #5 from Katsunori Kumatani  ---
Hi, any news of this for GCC 9? I'm guessing it requires a bit more changes,
hopefully not forgotten though. Currently I'm using a custom patched GCC 8 for
it (and to test plugin behavior with it) but it's not ideal.

[Bug tree-optimization/84013] wrong __restrict clique with inline asm operand

2018-02-01 Thread katsunori.kumatani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84013

--- Comment #4 from Katsunori Kumatani  ---
Thanks, it's quite useful in some "meta asm" cases (in conjunction with
plugins, asms can be useful since you can't add builtins). Or when doing custom
calls in asms (or syscalls, etc) and you know what memory they touch, without
having to clobber everything. :)

[Bug tree-optimization/84013] wrong __restrict clique with inline asm operand

2018-02-01 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84013

--- Comment #3 from rguenther at suse dot de  ---
On Wed, 31 Jan 2018, katsunori.kumatani at gmail dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84013
> 
> --- Comment #2 from Katsunori Kumatani  
> ---
> I'm not familiar with tree-ssa-structalias, but it appears to me that the 
> "fix"
> is quite simple? Or am I missing something? Here's the snippet from it, 
> updated
> with my attempt:
> 
>   if (restrict_var)
> {
>   /* Now look at possible dereferences of ptr.  */
>   imm_use_iterator ui;
>   gimple *use_stmt;
>   bool used = false;
>   FOR_EACH_IMM_USE_STMT (use_stmt, ui, ptr)
> {
>   if (!gimple_assign_single_p (use_stmt))
> {
>   /* ???  Calls.  */
>   if (gimple_code (use_stmt) != GIMPLE_ASM)
> continue;
> 
>   gasm *asm_stmt = as_a  (use_stmt);
>   unsigned n = gimple_asm_ninputs (asm_stmt);
>   for (unsigned i = 0; i < n; i++)
> {
>   tree op = TREE_VALUE (gimple_asm_input_op (asm_stmt, 
> i));
>   used |= maybe_set_dependence_info (op, ptr, clique,
>  restrict_var,
>  last_ruid);
> }
>   n = gimple_asm_noutputs (asm_stmt);
>   for (unsigned i = 0; i < n; i++)
> {
>   tree op = TREE_VALUE (gimple_asm_output_op (asm_stmt,
> i));
>   used |= maybe_set_dependence_info (op, ptr, clique,
>  restrict_var,
>  last_ruid);
> }
>   continue;
> }
> 
> 
> Does this not work? Sorry if I am missing something here.

Yes, this should work.  It's not difficult to fix I just thought it
wasn't important to track restrict across asm()s ...  A similar
fix is needed for call return and operands.  Writing the code
a little nicer and more compact should be possible as well - I
just need to think about it somewhat (similar to the code a bit
below we should be able to use walk_stmt_load_store_ops).

I will deal with this for GCC 9 given this isn't a regression.

[Bug tree-optimization/84013] wrong __restrict clique with inline asm operand

2018-01-31 Thread katsunori.kumatani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84013

--- Comment #2 from Katsunori Kumatani  ---
I'm not familiar with tree-ssa-structalias, but it appears to me that the "fix"
is quite simple? Or am I missing something? Here's the snippet from it, updated
with my attempt:

  if (restrict_var)
{
  /* Now look at possible dereferences of ptr.  */
  imm_use_iterator ui;
  gimple *use_stmt;
  bool used = false;
  FOR_EACH_IMM_USE_STMT (use_stmt, ui, ptr)
{
  if (!gimple_assign_single_p (use_stmt))
{
  /* ???  Calls.  */
  if (gimple_code (use_stmt) != GIMPLE_ASM)
continue;

  gasm *asm_stmt = as_a  (use_stmt);
  unsigned n = gimple_asm_ninputs (asm_stmt);
  for (unsigned i = 0; i < n; i++)
{
  tree op = TREE_VALUE (gimple_asm_input_op (asm_stmt, i));
  used |= maybe_set_dependence_info (op, ptr, clique,
 restrict_var,
 last_ruid);
}
  n = gimple_asm_noutputs (asm_stmt);
  for (unsigned i = 0; i < n; i++)
{
  tree op = TREE_VALUE (gimple_asm_output_op (asm_stmt,
i));
  used |= maybe_set_dependence_info (op, ptr, clique,
 restrict_var,
 last_ruid);
}
  continue;
}


Does this not work? Sorry if I am missing something here.

[Bug tree-optimization/84013] wrong __restrict clique with inline asm operand

2018-01-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84013

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-01-24
Version|tree-ssa|8.0
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
Yes, this is a known limitation:

  if (restrict_var)
{
  /* Now look at possible dereferences of ptr.  */
  imm_use_iterator ui;
  gimple *use_stmt;
  bool used = false;
  FOR_EACH_IMM_USE_STMT (use_stmt, ui, ptr)
{
  /* ???  Calls and asms.  */
  if (!gimple_assign_single_p (use_stmt))
continue;