]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/tree-ssa-loop-ivopts.cc
ivopts: Fix IP_END handling for asm goto [PR107997]
[gcc.git] / gcc / tree-ssa-loop-ivopts.cc
index 5b9044fc3f3fdee956ba994f2e72e6f60a4f7eb9..ebd4aecce37e5c77f57e9be0ebac212d9c4498eb 100644 (file)
@@ -131,6 +131,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "builtins.h"
 #include "tree-vectorizer.h"
 #include "dbgcnt.h"
+#include "cfganal.h"
 
 /* For lang_hooks.types.type_for_mode.  */
 #include "langhooks.h"
@@ -7235,6 +7236,12 @@ create_new_iv (struct ivopts_data *data, struct iv_cand *cand)
     case IP_END:
       incr_pos = gsi_last_bb (ip_end_pos (data->current_loop));
       after = true;
+      if (!gsi_end_p (incr_pos) && stmt_ends_bb_p (gsi_stmt (incr_pos)))
+       {
+         edge e = find_edge (gsi_bb (incr_pos), data->current_loop->header);
+         incr_pos = gsi_after_labels (split_edge (e));
+         after = false;
+       }
       break;
 
     case IP_AFTER_USE:
This page took 0.032744 seconds and 5 git commands to generate.