aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-03-02 14:31:46 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-03-02 14:31:46 +0000
commitd366a1a795d7b5c40abc3efae2dcc12e9e324b01 (patch)
tree3461e06a1a6f8e8435c6627a1547260fa007dd65 /gcc
parentcd1a470ab20ef25928fdf69085bb178339872468 (diff)
downloadgcc-d366a1a795d7b5c40abc3efae2dcc12e9e324b01.zip
gcc-d366a1a795d7b5c40abc3efae2dcc12e9e324b01.tar.gz
gcc-d366a1a795d7b5c40abc3efae2dcc12e9e324b01.tar.bz2
re PR ipa/65270 (issues with merging memory accesses from different code paths)
2015-03-02 Richard Biener <rguenther@suse.de> PR ipa/65270 * ipa-icf-gimple.c: Include builtins.h. (func_checker::compare_memory_operand): Compare base alignment. From-SVN: r221117
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ipa-icf-gimple.c19
2 files changed, 25 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 606d4c7..862f839 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-02 Richard Biener <rguenther@suse.de>
+
+ PR ipa/65270
+ * ipa-icf-gimple.c: Include builtins.h.
+ (func_checker::compare_memory_operand): Compare base alignment.
+
2015-03-02 Ilya Enkovich <ilya.enkovich@intel.com>
PR target/65184
diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index 7cc58d4..ffb4a50 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -77,6 +77,7 @@ along with GCC; see the file COPYING3. If not see
#include <list>
#include "tree-ssanames.h"
#include "tree-eh.h"
+#include "builtins.h"
#include "ipa-icf-gimple.h"
#include "ipa-icf.h"
@@ -286,6 +287,24 @@ func_checker::compare_memory_operand (tree t1, tree t2)
if (ao_ref_alias_set (&r1) != ao_ref_alias_set (&r2)
|| ao_ref_base_alias_set (&r1) != ao_ref_base_alias_set (&r2))
return return_false_with_msg ("ao alias sets are different");
+
+ /* We can't simply use get_object_alignment_1 on the full
+ reference as for accesses with variable indexes this reports
+ too conservative alignment. We also can't use the ao_ref_base
+ base objects as ao_ref_base happily strips MEM_REFs around
+ decls even though that may carry alignment info. */
+ b1 = t1;
+ while (handled_component_p (b1))
+ b1 = TREE_OPERAND (b1, 0);
+ b2 = t2;
+ while (handled_component_p (b2))
+ b2 = TREE_OPERAND (b2, 0);
+ unsigned int align1, align2;
+ unsigned HOST_WIDE_INT tem;
+ get_object_alignment_1 (b1, &align1, &tem);
+ get_object_alignment_1 (b2, &align2, &tem);
+ if (align1 != align2)
+ return return_false_with_msg ("different access alignment");
}
return compare_operand (t1, t2);