Hello,

> 
> Hm, the testcase looks like it should actually pass even for strict-
> align
> targets.  Martin?
> 
> Richard.
> 

I debugged the GCC and observed the below situation. Here is the code
snippet of this case:

static int
__attribute__((noinline))
ox (struct bovid *cow)
{
  cow->red = cow->red + cow->green + cow->green;
  return 0;
}

int main()
{
  struct bovid cow;
  .....

  ox (&cow);

  ....
}

In GCC the function access_precludes_ipa_sra_p will call function
tree_non_model_aligned_mem_p to check the align status of the access->expr.
For the case, the access->expr is a gimple expr in function ox:
cow_1(D)->red$3 = void. The mode for this expr is SFmode. Because
STRICT_ALIGNMENT is defined to 1, so the function get_object_alignment is
called and return the alignment for this expr is 8 bit. While the required
alignment for SFmode is 32 bit. So this expr is regarded as unaligned. The
SRA is stopped. Hope this investigation is helpful.

BR,
Terry


Reply via email to