tree-ssa-math-opts.c (execute_optimize_bswap): Search within BB from last to first.
authorKai Tietz <ktietz@redhat.com>
Tue, 28 Jun 2011 10:36:48 +0000 (12:36 +0200)
committerKai Tietz <ktietz@gcc.gnu.org>
Tue, 28 Jun 2011 10:36:48 +0000 (12:36 +0200)
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

gcc/ChangeLog
gcc/tree-ssa-math-opts.c

index 2e744e891688b9bcb21e53cddde4b12a951625c6..f655761b0608de4e030a2ba2fe2cce4fbbda5272 100644 (file)
@@ -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.
index 4da401827f4f38b0fc6875dd3879218a74dce110..49ec360f9cea06d28dc95132ad4ad692115a4e5a 100644 (file)
@@ -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;