@@ -2139,7 +2139,7 @@ loop_suitable_for_sm (struct loop *loop
edge ex;
for (i = 0; VEC_iterate (edge, exits, i, ex); i++)
- if (ex->flags & EDGE_ABNORMAL)
+ if (ex->flags & (EDGE_ABNORMAL | EDGE_EH))
return false;
return true;
@@ -0,0 +1,26 @@
+// PR tree-optimization/46864
+// { dg-do compile }
+// { dg-options "-O -fnon-call-exceptions" }
+
+int baz ();
+
+struct S
+{
+ int k;
+ bool bar () throw ()
+ {
+ int m = baz ();
+ for (int i = 0; i < m; i++)
+ k = i;
+ return m;
+ }
+};
+
+extern S *s;
+
+void
+foo ()
+{
+ while (baz () && s->bar ())
+ ;
+}