Hello,

The SRA optimization requires the reference to struct/union member must be
aligned to their natural boundary e.g. (int *) must be aligned to 4 byte
boundary. This is done in function tree_non_mode_aligned_mem_p. For target
like x86 that define "STRICT_ALIGNMENT" to 0, the function return false.
Afterward, the SRA is conducted. For target like ARM or MIPS that define
"STRICT_ALIGNMENT" to 1, the alignment status is checked by "align =
get_object_alignment (exp)". The function get_object_alignment rely on SSA
and tend to over-conservative. So for most cases, the SRA is stopped here.

This patch intends to skip this case for target that set STRICT_ALIGNMENT to
1 otherwise the case will fail due to the SRA isn't performed actually. OK
to commit to trunk?

BR,
Terry

2011-09-07  Terry Guo  <terry....@arm.com>

        * gcc.dg/ipa/ipa-sra-2.c: Only run on 
        targets that are non_strict_align.


diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c
b/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c
index 3437a81..c6b4d63 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details"  } */
+/* { dg-require-effective-target non_strict_align } */
 
 struct bovid
 {


Reply via email to