https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84013
--- Comment #3 from rguenther at suse dot de <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 <katsunori.kumatani at gmail dot com> > --- > 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 <gasm *> (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.