tree-cfgcleanup.c (tree_forwarder_block_p): Do not return false at -O0 if the locus...
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 19 Jun 2018 21:31:44 +0000 (21:31 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 19 Jun 2018 21:31:44 +0000 (21:31 +0000)
* tree-cfgcleanup.c (tree_forwarder_block_p): Do not return false at
-O0 if the locus represent UNKNOWN_LOCATION but have different values.

From-SVN: r261770

gcc/ChangeLog
gcc/tree-cfgcleanup.c

index cc607eb9700777087912bae3b743c5986897377c..8698635eaa4dc2a3e4b6d4cc4a2eb83bf4cc80f4 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-19  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * tree-cfgcleanup.c (tree_forwarder_block_p): Do not return false at
+       -O0 if the locus represent UNKNOWN_LOCATION but have different values.
+        
 2018-06-19  Aaron Sawdey  <acsawdey@linux.ibm.com>
 
        * config/rs6000/rs6000-string.c (select_block_compare_mode): Check
index d5464fdc4e4abc18998ecb4d49d23054ab1ccf93..b27ba8a7333bdf7720e12b1d26ef459bd25f8f5e 100644 (file)
@@ -346,8 +346,11 @@ tree_forwarder_block_p (basic_block bb, bool phi_wanted)
       if (e->src == ENTRY_BLOCK_PTR_FOR_FN (cfun) || (e->flags & EDGE_EH))
        return false;
       /* If goto_locus of any of the edges differs, prevent removing
-        the forwarder block for -O0.  */
-      else if (optimize == 0 && e->goto_locus != locus)
+        the forwarder block when not optimizing.  */
+      else if (!optimize
+              && (LOCATION_LOCUS (e->goto_locus) != UNKNOWN_LOCATION
+                  || LOCATION_LOCUS (locus) != UNKNOWN_LOCATION)
+              && e->goto_locus != locus)
        return false;
   }
 
@@ -362,7 +365,10 @@ tree_forwarder_block_p (basic_block bb, bool phi_wanted)
        case GIMPLE_LABEL:
          if (DECL_NONLOCAL (gimple_label_label (as_a <glabel *> (stmt))))
            return false;
-         if (optimize == 0 && gimple_location (stmt) != locus)
+         if (!optimize
+             && (gimple_has_location (stmt)
+                 || LOCATION_LOCUS (locus) != UNKNOWN_LOCATION)
+             && gimple_location (stmt) != locus)
            return false;
          break;