aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Tietz <ktietz@redhat.com>2011-06-28 12:36:48 +0200
committerKai Tietz <ktietz@gcc.gnu.org>2011-06-28 12:36:48 +0200
commit72a327296948f1d5294c83e12da496b6f05b364f (patch)
treeac5c15c338e9aabed44b83c80b55d5692a3255c6
parent88a00ef7d65f16ce3851cf8ebcda756c97113cee (diff)
downloadgcc-72a327296948f1d5294c83e12da496b6f05b364f.zip
gcc-72a327296948f1d5294c83e12da496b6f05b364f.tar.gz
gcc-72a327296948f1d5294c83e12da496b6f05b364f.tar.bz2
tree-ssa-math-opts.c (execute_optimize_bswap): Search within BB from last to first.
2011-06-28 Kai Tietz <ktietz@redhat.com> * tree-ssa-math-opts.c (execute_optimize_bswap): Search within BB from last to first. From-SVN: r175580
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-ssa-math-opts.c6
2 files changed, 10 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2e744e8..f655761 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2011-06-28 Kai Tietz <ktietz@redhat.com>
+
+ * tree-ssa-math-opts.c (execute_optimize_bswap): Search
+ within BB from last to first.
+
2011-06-28 Joseph Myers <joseph@codesourcery.com>
* genattr-common.c: New. Based on genattr.c.
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 4da4018..49ec360 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1821,7 +1821,11 @@ execute_optimize_bswap (void)
{
gimple_stmt_iterator gsi;
- for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ /* We do a reverse scan for bswap patterns to make sure we get the
+ widest match. As bswap pattern matching doesn't handle
+ previously inserted smaller bswap replacements as sub-
+ patterns, the wider variant wouldn't be detected. */
+ for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
{
gimple stmt = gsi_stmt (gsi);
tree bswap_src, bswap_type;